{-# 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.DeleteNetworkInsightsAccessScope
-- 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 Network Access Scope.
module Amazonka.EC2.DeleteNetworkInsightsAccessScope
  ( -- * Creating a Request
    DeleteNetworkInsightsAccessScope (..),
    newDeleteNetworkInsightsAccessScope,

    -- * Request Lenses
    deleteNetworkInsightsAccessScope_dryRun,
    deleteNetworkInsightsAccessScope_networkInsightsAccessScopeId,

    -- * Destructuring the Response
    DeleteNetworkInsightsAccessScopeResponse (..),
    newDeleteNetworkInsightsAccessScopeResponse,

    -- * Response Lenses
    deleteNetworkInsightsAccessScopeResponse_networkInsightsAccessScopeId,
    deleteNetworkInsightsAccessScopeResponse_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:/ 'newDeleteNetworkInsightsAccessScope' smart constructor.
data DeleteNetworkInsightsAccessScope = DeleteNetworkInsightsAccessScope'
  { -- | 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@.
    DeleteNetworkInsightsAccessScope -> Maybe Bool
dryRun :: Prelude.Maybe Prelude.Bool,
    -- | The ID of the Network Access Scope.
    DeleteNetworkInsightsAccessScope -> Text
networkInsightsAccessScopeId :: Prelude.Text
  }
  deriving (DeleteNetworkInsightsAccessScope
-> DeleteNetworkInsightsAccessScope -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteNetworkInsightsAccessScope
-> DeleteNetworkInsightsAccessScope -> Bool
$c/= :: DeleteNetworkInsightsAccessScope
-> DeleteNetworkInsightsAccessScope -> Bool
== :: DeleteNetworkInsightsAccessScope
-> DeleteNetworkInsightsAccessScope -> Bool
$c== :: DeleteNetworkInsightsAccessScope
-> DeleteNetworkInsightsAccessScope -> Bool
Prelude.Eq, ReadPrec [DeleteNetworkInsightsAccessScope]
ReadPrec DeleteNetworkInsightsAccessScope
Int -> ReadS DeleteNetworkInsightsAccessScope
ReadS [DeleteNetworkInsightsAccessScope]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteNetworkInsightsAccessScope]
$creadListPrec :: ReadPrec [DeleteNetworkInsightsAccessScope]
readPrec :: ReadPrec DeleteNetworkInsightsAccessScope
$creadPrec :: ReadPrec DeleteNetworkInsightsAccessScope
readList :: ReadS [DeleteNetworkInsightsAccessScope]
$creadList :: ReadS [DeleteNetworkInsightsAccessScope]
readsPrec :: Int -> ReadS DeleteNetworkInsightsAccessScope
$creadsPrec :: Int -> ReadS DeleteNetworkInsightsAccessScope
Prelude.Read, Int -> DeleteNetworkInsightsAccessScope -> ShowS
[DeleteNetworkInsightsAccessScope] -> ShowS
DeleteNetworkInsightsAccessScope -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteNetworkInsightsAccessScope] -> ShowS
$cshowList :: [DeleteNetworkInsightsAccessScope] -> ShowS
show :: DeleteNetworkInsightsAccessScope -> String
$cshow :: DeleteNetworkInsightsAccessScope -> String
showsPrec :: Int -> DeleteNetworkInsightsAccessScope -> ShowS
$cshowsPrec :: Int -> DeleteNetworkInsightsAccessScope -> ShowS
Prelude.Show, forall x.
Rep DeleteNetworkInsightsAccessScope x
-> DeleteNetworkInsightsAccessScope
forall x.
DeleteNetworkInsightsAccessScope
-> Rep DeleteNetworkInsightsAccessScope x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteNetworkInsightsAccessScope x
-> DeleteNetworkInsightsAccessScope
$cfrom :: forall x.
DeleteNetworkInsightsAccessScope
-> Rep DeleteNetworkInsightsAccessScope x
Prelude.Generic)

-- |
-- Create a value of 'DeleteNetworkInsightsAccessScope' 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', 'deleteNetworkInsightsAccessScope_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@.
--
-- 'networkInsightsAccessScopeId', 'deleteNetworkInsightsAccessScope_networkInsightsAccessScopeId' - The ID of the Network Access Scope.
newDeleteNetworkInsightsAccessScope ::
  -- | 'networkInsightsAccessScopeId'
  Prelude.Text ->
  DeleteNetworkInsightsAccessScope
newDeleteNetworkInsightsAccessScope :: Text -> DeleteNetworkInsightsAccessScope
newDeleteNetworkInsightsAccessScope
  Text
pNetworkInsightsAccessScopeId_ =
    DeleteNetworkInsightsAccessScope'
      { $sel:dryRun:DeleteNetworkInsightsAccessScope' :: Maybe Bool
dryRun =
          forall a. Maybe a
Prelude.Nothing,
        $sel:networkInsightsAccessScopeId:DeleteNetworkInsightsAccessScope' :: Text
networkInsightsAccessScopeId =
          Text
pNetworkInsightsAccessScopeId_
      }

-- | 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@.
deleteNetworkInsightsAccessScope_dryRun :: Lens.Lens' DeleteNetworkInsightsAccessScope (Prelude.Maybe Prelude.Bool)
deleteNetworkInsightsAccessScope_dryRun :: Lens' DeleteNetworkInsightsAccessScope (Maybe Bool)
deleteNetworkInsightsAccessScope_dryRun = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteNetworkInsightsAccessScope' {Maybe Bool
dryRun :: Maybe Bool
$sel:dryRun:DeleteNetworkInsightsAccessScope' :: DeleteNetworkInsightsAccessScope -> Maybe Bool
dryRun} -> Maybe Bool
dryRun) (\s :: DeleteNetworkInsightsAccessScope
s@DeleteNetworkInsightsAccessScope' {} Maybe Bool
a -> DeleteNetworkInsightsAccessScope
s {$sel:dryRun:DeleteNetworkInsightsAccessScope' :: Maybe Bool
dryRun = Maybe Bool
a} :: DeleteNetworkInsightsAccessScope)

-- | The ID of the Network Access Scope.
deleteNetworkInsightsAccessScope_networkInsightsAccessScopeId :: Lens.Lens' DeleteNetworkInsightsAccessScope Prelude.Text
deleteNetworkInsightsAccessScope_networkInsightsAccessScopeId :: Lens' DeleteNetworkInsightsAccessScope Text
deleteNetworkInsightsAccessScope_networkInsightsAccessScopeId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteNetworkInsightsAccessScope' {Text
networkInsightsAccessScopeId :: Text
$sel:networkInsightsAccessScopeId:DeleteNetworkInsightsAccessScope' :: DeleteNetworkInsightsAccessScope -> Text
networkInsightsAccessScopeId} -> Text
networkInsightsAccessScopeId) (\s :: DeleteNetworkInsightsAccessScope
s@DeleteNetworkInsightsAccessScope' {} Text
a -> DeleteNetworkInsightsAccessScope
s {$sel:networkInsightsAccessScopeId:DeleteNetworkInsightsAccessScope' :: Text
networkInsightsAccessScopeId = Text
a} :: DeleteNetworkInsightsAccessScope)

instance
  Core.AWSRequest
    DeleteNetworkInsightsAccessScope
  where
  type
    AWSResponse DeleteNetworkInsightsAccessScope =
      DeleteNetworkInsightsAccessScopeResponse
  request :: (Service -> Service)
-> DeleteNetworkInsightsAccessScope
-> Request DeleteNetworkInsightsAccessScope
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 DeleteNetworkInsightsAccessScope
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse DeleteNetworkInsightsAccessScope)))
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 -> DeleteNetworkInsightsAccessScopeResponse
DeleteNetworkInsightsAccessScopeResponse'
            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
"networkInsightsAccessScopeId")
            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
    DeleteNetworkInsightsAccessScope
  where
  hashWithSalt :: Int -> DeleteNetworkInsightsAccessScope -> Int
hashWithSalt
    Int
_salt
    DeleteNetworkInsightsAccessScope' {Maybe Bool
Text
networkInsightsAccessScopeId :: Text
dryRun :: Maybe Bool
$sel:networkInsightsAccessScopeId:DeleteNetworkInsightsAccessScope' :: DeleteNetworkInsightsAccessScope -> Text
$sel:dryRun:DeleteNetworkInsightsAccessScope' :: DeleteNetworkInsightsAccessScope -> 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
networkInsightsAccessScopeId

instance
  Prelude.NFData
    DeleteNetworkInsightsAccessScope
  where
  rnf :: DeleteNetworkInsightsAccessScope -> ()
rnf DeleteNetworkInsightsAccessScope' {Maybe Bool
Text
networkInsightsAccessScopeId :: Text
dryRun :: Maybe Bool
$sel:networkInsightsAccessScopeId:DeleteNetworkInsightsAccessScope' :: DeleteNetworkInsightsAccessScope -> Text
$sel:dryRun:DeleteNetworkInsightsAccessScope' :: DeleteNetworkInsightsAccessScope -> 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
networkInsightsAccessScopeId

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

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

instance
  Data.ToQuery
    DeleteNetworkInsightsAccessScope
  where
  toQuery :: DeleteNetworkInsightsAccessScope -> QueryString
toQuery DeleteNetworkInsightsAccessScope' {Maybe Bool
Text
networkInsightsAccessScopeId :: Text
dryRun :: Maybe Bool
$sel:networkInsightsAccessScopeId:DeleteNetworkInsightsAccessScope' :: DeleteNetworkInsightsAccessScope -> Text
$sel:dryRun:DeleteNetworkInsightsAccessScope' :: DeleteNetworkInsightsAccessScope -> Maybe Bool
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: ( ByteString
"DeleteNetworkInsightsAccessScope" ::
                      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
"NetworkInsightsAccessScopeId"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
networkInsightsAccessScopeId
      ]

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

-- |
-- Create a value of 'DeleteNetworkInsightsAccessScopeResponse' 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:
--
-- 'networkInsightsAccessScopeId', 'deleteNetworkInsightsAccessScopeResponse_networkInsightsAccessScopeId' - The ID of the Network Access Scope.
--
-- 'httpStatus', 'deleteNetworkInsightsAccessScopeResponse_httpStatus' - The response's http status code.
newDeleteNetworkInsightsAccessScopeResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteNetworkInsightsAccessScopeResponse
newDeleteNetworkInsightsAccessScopeResponse :: Int -> DeleteNetworkInsightsAccessScopeResponse
newDeleteNetworkInsightsAccessScopeResponse
  Int
pHttpStatus_ =
    DeleteNetworkInsightsAccessScopeResponse'
      { $sel:networkInsightsAccessScopeId:DeleteNetworkInsightsAccessScopeResponse' :: Maybe Text
networkInsightsAccessScopeId =
          forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:DeleteNetworkInsightsAccessScopeResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | The ID of the Network Access Scope.
deleteNetworkInsightsAccessScopeResponse_networkInsightsAccessScopeId :: Lens.Lens' DeleteNetworkInsightsAccessScopeResponse (Prelude.Maybe Prelude.Text)
deleteNetworkInsightsAccessScopeResponse_networkInsightsAccessScopeId :: Lens' DeleteNetworkInsightsAccessScopeResponse (Maybe Text)
deleteNetworkInsightsAccessScopeResponse_networkInsightsAccessScopeId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteNetworkInsightsAccessScopeResponse' {Maybe Text
networkInsightsAccessScopeId :: Maybe Text
$sel:networkInsightsAccessScopeId:DeleteNetworkInsightsAccessScopeResponse' :: DeleteNetworkInsightsAccessScopeResponse -> Maybe Text
networkInsightsAccessScopeId} -> Maybe Text
networkInsightsAccessScopeId) (\s :: DeleteNetworkInsightsAccessScopeResponse
s@DeleteNetworkInsightsAccessScopeResponse' {} Maybe Text
a -> DeleteNetworkInsightsAccessScopeResponse
s {$sel:networkInsightsAccessScopeId:DeleteNetworkInsightsAccessScopeResponse' :: Maybe Text
networkInsightsAccessScopeId = Maybe Text
a} :: DeleteNetworkInsightsAccessScopeResponse)

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

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