{-# 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.EC2.DeleteNetworkInsightsPath
-- 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 the specified path.
module Amazonka.EC2.DeleteNetworkInsightsPath
  ( -- * Creating a Request
    DeleteNetworkInsightsPath (..),
    newDeleteNetworkInsightsPath,

    -- * Request Lenses
    deleteNetworkInsightsPath_dryRun,
    deleteNetworkInsightsPath_networkInsightsPathId,

    -- * Destructuring the Response
    DeleteNetworkInsightsPathResponse (..),
    newDeleteNetworkInsightsPathResponse,

    -- * Response Lenses
    deleteNetworkInsightsPathResponse_networkInsightsPathId,
    deleteNetworkInsightsPathResponse_httpStatus,
  )
where

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

-- | /See:/ 'newDeleteNetworkInsightsPath' smart constructor.
data DeleteNetworkInsightsPath = DeleteNetworkInsightsPath'
  { -- | Checks whether you have the required permissions for the action, without
    -- actually making the request, and provides an error response. If you have
    -- the required permissions, the error response is @DryRunOperation@.
    -- Otherwise, it is @UnauthorizedOperation@.
    DeleteNetworkInsightsPath -> Maybe Bool
dryRun :: Prelude.Maybe Prelude.Bool,
    -- | The ID of the path.
    DeleteNetworkInsightsPath -> Text
networkInsightsPathId :: Prelude.Text
  }
  deriving (DeleteNetworkInsightsPath -> DeleteNetworkInsightsPath -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteNetworkInsightsPath -> DeleteNetworkInsightsPath -> Bool
$c/= :: DeleteNetworkInsightsPath -> DeleteNetworkInsightsPath -> Bool
== :: DeleteNetworkInsightsPath -> DeleteNetworkInsightsPath -> Bool
$c== :: DeleteNetworkInsightsPath -> DeleteNetworkInsightsPath -> Bool
Prelude.Eq, ReadPrec [DeleteNetworkInsightsPath]
ReadPrec DeleteNetworkInsightsPath
Int -> ReadS DeleteNetworkInsightsPath
ReadS [DeleteNetworkInsightsPath]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteNetworkInsightsPath]
$creadListPrec :: ReadPrec [DeleteNetworkInsightsPath]
readPrec :: ReadPrec DeleteNetworkInsightsPath
$creadPrec :: ReadPrec DeleteNetworkInsightsPath
readList :: ReadS [DeleteNetworkInsightsPath]
$creadList :: ReadS [DeleteNetworkInsightsPath]
readsPrec :: Int -> ReadS DeleteNetworkInsightsPath
$creadsPrec :: Int -> ReadS DeleteNetworkInsightsPath
Prelude.Read, Int -> DeleteNetworkInsightsPath -> ShowS
[DeleteNetworkInsightsPath] -> ShowS
DeleteNetworkInsightsPath -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteNetworkInsightsPath] -> ShowS
$cshowList :: [DeleteNetworkInsightsPath] -> ShowS
show :: DeleteNetworkInsightsPath -> String
$cshow :: DeleteNetworkInsightsPath -> String
showsPrec :: Int -> DeleteNetworkInsightsPath -> ShowS
$cshowsPrec :: Int -> DeleteNetworkInsightsPath -> ShowS
Prelude.Show, forall x.
Rep DeleteNetworkInsightsPath x -> DeleteNetworkInsightsPath
forall x.
DeleteNetworkInsightsPath -> Rep DeleteNetworkInsightsPath x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteNetworkInsightsPath x -> DeleteNetworkInsightsPath
$cfrom :: forall x.
DeleteNetworkInsightsPath -> Rep DeleteNetworkInsightsPath x
Prelude.Generic)

-- |
-- Create a value of 'DeleteNetworkInsightsPath' 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:
--
-- 'dryRun', 'deleteNetworkInsightsPath_dryRun' - Checks whether you have the required permissions for the action, without
-- actually making the request, and provides an error response. If you have
-- the required permissions, the error response is @DryRunOperation@.
-- Otherwise, it is @UnauthorizedOperation@.
--
-- 'networkInsightsPathId', 'deleteNetworkInsightsPath_networkInsightsPathId' - The ID of the path.
newDeleteNetworkInsightsPath ::
  -- | 'networkInsightsPathId'
  Prelude.Text ->
  DeleteNetworkInsightsPath
newDeleteNetworkInsightsPath :: Text -> DeleteNetworkInsightsPath
newDeleteNetworkInsightsPath Text
pNetworkInsightsPathId_ =
  DeleteNetworkInsightsPath'
    { $sel:dryRun:DeleteNetworkInsightsPath' :: Maybe Bool
dryRun =
        forall a. Maybe a
Prelude.Nothing,
      $sel:networkInsightsPathId:DeleteNetworkInsightsPath' :: Text
networkInsightsPathId = Text
pNetworkInsightsPathId_
    }

-- | Checks whether you have the required permissions for the action, without
-- actually making the request, and provides an error response. If you have
-- the required permissions, the error response is @DryRunOperation@.
-- Otherwise, it is @UnauthorizedOperation@.
deleteNetworkInsightsPath_dryRun :: Lens.Lens' DeleteNetworkInsightsPath (Prelude.Maybe Prelude.Bool)
deleteNetworkInsightsPath_dryRun :: Lens' DeleteNetworkInsightsPath (Maybe Bool)
deleteNetworkInsightsPath_dryRun = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteNetworkInsightsPath' {Maybe Bool
dryRun :: Maybe Bool
$sel:dryRun:DeleteNetworkInsightsPath' :: DeleteNetworkInsightsPath -> Maybe Bool
dryRun} -> Maybe Bool
dryRun) (\s :: DeleteNetworkInsightsPath
s@DeleteNetworkInsightsPath' {} Maybe Bool
a -> DeleteNetworkInsightsPath
s {$sel:dryRun:DeleteNetworkInsightsPath' :: Maybe Bool
dryRun = Maybe Bool
a} :: DeleteNetworkInsightsPath)

-- | The ID of the path.
deleteNetworkInsightsPath_networkInsightsPathId :: Lens.Lens' DeleteNetworkInsightsPath Prelude.Text
deleteNetworkInsightsPath_networkInsightsPathId :: Lens' DeleteNetworkInsightsPath Text
deleteNetworkInsightsPath_networkInsightsPathId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteNetworkInsightsPath' {Text
networkInsightsPathId :: Text
$sel:networkInsightsPathId:DeleteNetworkInsightsPath' :: DeleteNetworkInsightsPath -> Text
networkInsightsPathId} -> Text
networkInsightsPathId) (\s :: DeleteNetworkInsightsPath
s@DeleteNetworkInsightsPath' {} Text
a -> DeleteNetworkInsightsPath
s {$sel:networkInsightsPathId:DeleteNetworkInsightsPath' :: Text
networkInsightsPathId = Text
a} :: DeleteNetworkInsightsPath)

instance Core.AWSRequest DeleteNetworkInsightsPath where
  type
    AWSResponse DeleteNetworkInsightsPath =
      DeleteNetworkInsightsPathResponse
  request :: (Service -> Service)
-> DeleteNetworkInsightsPath -> Request DeleteNetworkInsightsPath
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.postQuery (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DeleteNetworkInsightsPath
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteNetworkInsightsPath)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXML
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe Text -> Int -> DeleteNetworkInsightsPathResponse
DeleteNetworkInsightsPathResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"networkInsightsPathId")
            forall (f :: * -> *) a b. Applicative f => 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 DeleteNetworkInsightsPath where
  hashWithSalt :: Int -> DeleteNetworkInsightsPath -> Int
hashWithSalt Int
_salt DeleteNetworkInsightsPath' {Maybe Bool
Text
networkInsightsPathId :: Text
dryRun :: Maybe Bool
$sel:networkInsightsPathId:DeleteNetworkInsightsPath' :: DeleteNetworkInsightsPath -> Text
$sel:dryRun:DeleteNetworkInsightsPath' :: DeleteNetworkInsightsPath -> Maybe Bool
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
dryRun
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
networkInsightsPathId

instance Prelude.NFData DeleteNetworkInsightsPath where
  rnf :: DeleteNetworkInsightsPath -> ()
rnf DeleteNetworkInsightsPath' {Maybe Bool
Text
networkInsightsPathId :: Text
dryRun :: Maybe Bool
$sel:networkInsightsPathId:DeleteNetworkInsightsPath' :: DeleteNetworkInsightsPath -> Text
$sel:dryRun:DeleteNetworkInsightsPath' :: DeleteNetworkInsightsPath -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
dryRun
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
networkInsightsPathId

instance Data.ToHeaders DeleteNetworkInsightsPath where
  toHeaders :: DeleteNetworkInsightsPath -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

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

instance Data.ToQuery DeleteNetworkInsightsPath where
  toQuery :: DeleteNetworkInsightsPath -> QueryString
toQuery DeleteNetworkInsightsPath' {Maybe Bool
Text
networkInsightsPathId :: Text
dryRun :: Maybe Bool
$sel:networkInsightsPathId:DeleteNetworkInsightsPath' :: DeleteNetworkInsightsPath -> Text
$sel:dryRun:DeleteNetworkInsightsPath' :: DeleteNetworkInsightsPath -> Maybe Bool
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"DeleteNetworkInsightsPath" :: Prelude.ByteString),
        ByteString
"Version"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2016-11-15" :: Prelude.ByteString),
        ByteString
"DryRun" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Bool
dryRun,
        ByteString
"NetworkInsightsPathId"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
networkInsightsPathId
      ]

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

-- |
-- Create a value of 'DeleteNetworkInsightsPathResponse' 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:
--
-- 'networkInsightsPathId', 'deleteNetworkInsightsPathResponse_networkInsightsPathId' - The ID of the path.
--
-- 'httpStatus', 'deleteNetworkInsightsPathResponse_httpStatus' - The response's http status code.
newDeleteNetworkInsightsPathResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteNetworkInsightsPathResponse
newDeleteNetworkInsightsPathResponse :: Int -> DeleteNetworkInsightsPathResponse
newDeleteNetworkInsightsPathResponse Int
pHttpStatus_ =
  DeleteNetworkInsightsPathResponse'
    { $sel:networkInsightsPathId:DeleteNetworkInsightsPathResponse' :: Maybe Text
networkInsightsPathId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DeleteNetworkInsightsPathResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The ID of the path.
deleteNetworkInsightsPathResponse_networkInsightsPathId :: Lens.Lens' DeleteNetworkInsightsPathResponse (Prelude.Maybe Prelude.Text)
deleteNetworkInsightsPathResponse_networkInsightsPathId :: Lens' DeleteNetworkInsightsPathResponse (Maybe Text)
deleteNetworkInsightsPathResponse_networkInsightsPathId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteNetworkInsightsPathResponse' {Maybe Text
networkInsightsPathId :: Maybe Text
$sel:networkInsightsPathId:DeleteNetworkInsightsPathResponse' :: DeleteNetworkInsightsPathResponse -> Maybe Text
networkInsightsPathId} -> Maybe Text
networkInsightsPathId) (\s :: DeleteNetworkInsightsPathResponse
s@DeleteNetworkInsightsPathResponse' {} Maybe Text
a -> DeleteNetworkInsightsPathResponse
s {$sel:networkInsightsPathId:DeleteNetworkInsightsPathResponse' :: Maybe Text
networkInsightsPathId = Maybe Text
a} :: DeleteNetworkInsightsPathResponse)

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

instance
  Prelude.NFData
    DeleteNetworkInsightsPathResponse
  where
  rnf :: DeleteNetworkInsightsPathResponse -> ()
rnf DeleteNetworkInsightsPathResponse' {Int
Maybe Text
httpStatus :: Int
networkInsightsPathId :: Maybe Text
$sel:httpStatus:DeleteNetworkInsightsPathResponse' :: DeleteNetworkInsightsPathResponse -> Int
$sel:networkInsightsPathId:DeleteNetworkInsightsPathResponse' :: DeleteNetworkInsightsPathResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
networkInsightsPathId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus