{-# 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.SSM.DeletePatchBaseline
-- 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 a patch baseline.
module Amazonka.SSM.DeletePatchBaseline
  ( -- * Creating a Request
    DeletePatchBaseline (..),
    newDeletePatchBaseline,

    -- * Request Lenses
    deletePatchBaseline_baselineId,

    -- * Destructuring the Response
    DeletePatchBaselineResponse (..),
    newDeletePatchBaselineResponse,

    -- * Response Lenses
    deletePatchBaselineResponse_baselineId,
    deletePatchBaselineResponse_httpStatus,
  )
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.SSM.Types

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

-- |
-- Create a value of 'DeletePatchBaseline' 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:
--
-- 'baselineId', 'deletePatchBaseline_baselineId' - The ID of the patch baseline to delete.
newDeletePatchBaseline ::
  -- | 'baselineId'
  Prelude.Text ->
  DeletePatchBaseline
newDeletePatchBaseline :: Text -> DeletePatchBaseline
newDeletePatchBaseline Text
pBaselineId_ =
  DeletePatchBaseline' :: Text -> DeletePatchBaseline
DeletePatchBaseline' {$sel:baselineId:DeletePatchBaseline' :: Text
baselineId = Text
pBaselineId_}

-- | The ID of the patch baseline to delete.
deletePatchBaseline_baselineId :: Lens.Lens' DeletePatchBaseline Prelude.Text
deletePatchBaseline_baselineId :: (Text -> f Text) -> DeletePatchBaseline -> f DeletePatchBaseline
deletePatchBaseline_baselineId = (DeletePatchBaseline -> Text)
-> (DeletePatchBaseline -> Text -> DeletePatchBaseline)
-> Lens DeletePatchBaseline DeletePatchBaseline Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeletePatchBaseline' {Text
baselineId :: Text
$sel:baselineId:DeletePatchBaseline' :: DeletePatchBaseline -> Text
baselineId} -> Text
baselineId) (\s :: DeletePatchBaseline
s@DeletePatchBaseline' {} Text
a -> DeletePatchBaseline
s {$sel:baselineId:DeletePatchBaseline' :: Text
baselineId = Text
a} :: DeletePatchBaseline)

instance Core.AWSRequest DeletePatchBaseline where
  type
    AWSResponse DeletePatchBaseline =
      DeletePatchBaselineResponse
  request :: DeletePatchBaseline -> Request DeletePatchBaseline
request = Service -> DeletePatchBaseline -> Request DeletePatchBaseline
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeletePatchBaseline
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeletePatchBaseline)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DeletePatchBaseline))
-> Logger
-> Service
-> Proxy DeletePatchBaseline
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeletePatchBaseline)))
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 ->
          Maybe Text -> Int -> DeletePatchBaselineResponse
DeletePatchBaselineResponse'
            (Maybe Text -> Int -> DeletePatchBaselineResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DeletePatchBaselineResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"BaselineId")
            Either String (Int -> DeletePatchBaselineResponse)
-> Either String Int -> Either String DeletePatchBaselineResponse
forall (f :: * -> *) a b. Applicative f => 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 DeletePatchBaseline

instance Prelude.NFData DeletePatchBaseline

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

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

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

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

-- |
-- Create a value of 'DeletePatchBaselineResponse' 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:
--
-- 'baselineId', 'deletePatchBaselineResponse_baselineId' - The ID of the deleted patch baseline.
--
-- 'httpStatus', 'deletePatchBaselineResponse_httpStatus' - The response's http status code.
newDeletePatchBaselineResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeletePatchBaselineResponse
newDeletePatchBaselineResponse :: Int -> DeletePatchBaselineResponse
newDeletePatchBaselineResponse Int
pHttpStatus_ =
  DeletePatchBaselineResponse' :: Maybe Text -> Int -> DeletePatchBaselineResponse
DeletePatchBaselineResponse'
    { $sel:baselineId:DeletePatchBaselineResponse' :: Maybe Text
baselineId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DeletePatchBaselineResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The ID of the deleted patch baseline.
deletePatchBaselineResponse_baselineId :: Lens.Lens' DeletePatchBaselineResponse (Prelude.Maybe Prelude.Text)
deletePatchBaselineResponse_baselineId :: (Maybe Text -> f (Maybe Text))
-> DeletePatchBaselineResponse -> f DeletePatchBaselineResponse
deletePatchBaselineResponse_baselineId = (DeletePatchBaselineResponse -> Maybe Text)
-> (DeletePatchBaselineResponse
    -> Maybe Text -> DeletePatchBaselineResponse)
-> Lens
     DeletePatchBaselineResponse
     DeletePatchBaselineResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeletePatchBaselineResponse' {Maybe Text
baselineId :: Maybe Text
$sel:baselineId:DeletePatchBaselineResponse' :: DeletePatchBaselineResponse -> Maybe Text
baselineId} -> Maybe Text
baselineId) (\s :: DeletePatchBaselineResponse
s@DeletePatchBaselineResponse' {} Maybe Text
a -> DeletePatchBaselineResponse
s {$sel:baselineId:DeletePatchBaselineResponse' :: Maybe Text
baselineId = Maybe Text
a} :: DeletePatchBaselineResponse)

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

instance Prelude.NFData DeletePatchBaselineResponse