{-# 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-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)
--
-- 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.Lens as Lens
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
(DeleteContainerService -> DeleteContainerService -> Bool)
-> (DeleteContainerService -> DeleteContainerService -> Bool)
-> Eq DeleteContainerService
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]
(Int -> ReadS DeleteContainerService)
-> ReadS [DeleteContainerService]
-> ReadPrec DeleteContainerService
-> ReadPrec [DeleteContainerService]
-> Read 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
(Int -> DeleteContainerService -> ShowS)
-> (DeleteContainerService -> String)
-> ([DeleteContainerService] -> ShowS)
-> Show DeleteContainerService
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. DeleteContainerService -> Rep DeleteContainerService x)
-> (forall x.
    Rep DeleteContainerService x -> DeleteContainerService)
-> Generic DeleteContainerService
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' :: Text -> DeleteContainerService
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 :: (Text -> f Text)
-> DeleteContainerService -> f DeleteContainerService
deleteContainerService_serviceName = (DeleteContainerService -> Text)
-> (DeleteContainerService -> Text -> DeleteContainerService)
-> Lens DeleteContainerService DeleteContainerService Text Text
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 :: DeleteContainerService -> Request DeleteContainerService
request = Service -> DeleteContainerService -> Request DeleteContainerService
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteContainerService
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteContainerService)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteContainerService))
-> Logger
-> Service
-> Proxy DeleteContainerService
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteContainerService)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeleteContainerServiceResponse
DeleteContainerServiceResponse'
            (Int -> DeleteContainerServiceResponse)
-> Either String Int
-> Either String DeleteContainerServiceResponse
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))
      )

instance Prelude.Hashable DeleteContainerService

instance Prelude.NFData DeleteContainerService

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

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

instance Core.ToQuery DeleteContainerService where
  toQuery :: DeleteContainerService -> QueryString
toQuery = QueryString -> DeleteContainerService -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(DeleteContainerServiceResponse
 -> DeleteContainerServiceResponse -> Bool)
-> (DeleteContainerServiceResponse
    -> DeleteContainerServiceResponse -> Bool)
-> Eq DeleteContainerServiceResponse
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]
(Int -> ReadS DeleteContainerServiceResponse)
-> ReadS [DeleteContainerServiceResponse]
-> ReadPrec DeleteContainerServiceResponse
-> ReadPrec [DeleteContainerServiceResponse]
-> Read 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
(Int -> DeleteContainerServiceResponse -> ShowS)
-> (DeleteContainerServiceResponse -> String)
-> ([DeleteContainerServiceResponse] -> ShowS)
-> Show DeleteContainerServiceResponse
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.
 DeleteContainerServiceResponse
 -> Rep DeleteContainerServiceResponse x)
-> (forall x.
    Rep DeleteContainerServiceResponse x
    -> DeleteContainerServiceResponse)
-> Generic DeleteContainerServiceResponse
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' :: Int -> DeleteContainerServiceResponse
DeleteContainerServiceResponse'
    { $sel:httpStatus:DeleteContainerServiceResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

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