{-# 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.SecurityHub.BatchDisableStandards
-- 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)
--
-- Disables the standards specified by the provided
-- @StandardsSubscriptionArns@.
--
-- For more information, see
-- <https://docs.aws.amazon.com/securityhub/latest/userguide/securityhub-standards.html Security Standards>
-- section of the /Security Hub User Guide/.
module Amazonka.SecurityHub.BatchDisableStandards
  ( -- * Creating a Request
    BatchDisableStandards (..),
    newBatchDisableStandards,

    -- * Request Lenses
    batchDisableStandards_standardsSubscriptionArns,

    -- * Destructuring the Response
    BatchDisableStandardsResponse (..),
    newBatchDisableStandardsResponse,

    -- * Response Lenses
    batchDisableStandardsResponse_standardsSubscriptions,
    batchDisableStandardsResponse_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.SecurityHub.Types

-- | /See:/ 'newBatchDisableStandards' smart constructor.
data BatchDisableStandards = BatchDisableStandards'
  { -- | The ARNs of the standards subscriptions to disable.
    BatchDisableStandards -> NonEmpty Text
standardsSubscriptionArns :: Prelude.NonEmpty Prelude.Text
  }
  deriving (BatchDisableStandards -> BatchDisableStandards -> Bool
(BatchDisableStandards -> BatchDisableStandards -> Bool)
-> (BatchDisableStandards -> BatchDisableStandards -> Bool)
-> Eq BatchDisableStandards
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchDisableStandards -> BatchDisableStandards -> Bool
$c/= :: BatchDisableStandards -> BatchDisableStandards -> Bool
== :: BatchDisableStandards -> BatchDisableStandards -> Bool
$c== :: BatchDisableStandards -> BatchDisableStandards -> Bool
Prelude.Eq, ReadPrec [BatchDisableStandards]
ReadPrec BatchDisableStandards
Int -> ReadS BatchDisableStandards
ReadS [BatchDisableStandards]
(Int -> ReadS BatchDisableStandards)
-> ReadS [BatchDisableStandards]
-> ReadPrec BatchDisableStandards
-> ReadPrec [BatchDisableStandards]
-> Read BatchDisableStandards
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchDisableStandards]
$creadListPrec :: ReadPrec [BatchDisableStandards]
readPrec :: ReadPrec BatchDisableStandards
$creadPrec :: ReadPrec BatchDisableStandards
readList :: ReadS [BatchDisableStandards]
$creadList :: ReadS [BatchDisableStandards]
readsPrec :: Int -> ReadS BatchDisableStandards
$creadsPrec :: Int -> ReadS BatchDisableStandards
Prelude.Read, Int -> BatchDisableStandards -> ShowS
[BatchDisableStandards] -> ShowS
BatchDisableStandards -> String
(Int -> BatchDisableStandards -> ShowS)
-> (BatchDisableStandards -> String)
-> ([BatchDisableStandards] -> ShowS)
-> Show BatchDisableStandards
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchDisableStandards] -> ShowS
$cshowList :: [BatchDisableStandards] -> ShowS
show :: BatchDisableStandards -> String
$cshow :: BatchDisableStandards -> String
showsPrec :: Int -> BatchDisableStandards -> ShowS
$cshowsPrec :: Int -> BatchDisableStandards -> ShowS
Prelude.Show, (forall x. BatchDisableStandards -> Rep BatchDisableStandards x)
-> (forall x. Rep BatchDisableStandards x -> BatchDisableStandards)
-> Generic BatchDisableStandards
forall x. Rep BatchDisableStandards x -> BatchDisableStandards
forall x. BatchDisableStandards -> Rep BatchDisableStandards x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BatchDisableStandards x -> BatchDisableStandards
$cfrom :: forall x. BatchDisableStandards -> Rep BatchDisableStandards x
Prelude.Generic)

-- |
-- Create a value of 'BatchDisableStandards' 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:
--
-- 'standardsSubscriptionArns', 'batchDisableStandards_standardsSubscriptionArns' - The ARNs of the standards subscriptions to disable.
newBatchDisableStandards ::
  -- | 'standardsSubscriptionArns'
  Prelude.NonEmpty Prelude.Text ->
  BatchDisableStandards
newBatchDisableStandards :: NonEmpty Text -> BatchDisableStandards
newBatchDisableStandards NonEmpty Text
pStandardsSubscriptionArns_ =
  BatchDisableStandards' :: NonEmpty Text -> BatchDisableStandards
BatchDisableStandards'
    { $sel:standardsSubscriptionArns:BatchDisableStandards' :: NonEmpty Text
standardsSubscriptionArns =
        Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty Text) (Identity (NonEmpty Text))
 -> Tagged (NonEmpty Text) (Identity (NonEmpty Text)))
-> NonEmpty Text -> NonEmpty Text
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pStandardsSubscriptionArns_
    }

-- | The ARNs of the standards subscriptions to disable.
batchDisableStandards_standardsSubscriptionArns :: Lens.Lens' BatchDisableStandards (Prelude.NonEmpty Prelude.Text)
batchDisableStandards_standardsSubscriptionArns :: (NonEmpty Text -> f (NonEmpty Text))
-> BatchDisableStandards -> f BatchDisableStandards
batchDisableStandards_standardsSubscriptionArns = (BatchDisableStandards -> NonEmpty Text)
-> (BatchDisableStandards
    -> NonEmpty Text -> BatchDisableStandards)
-> Lens
     BatchDisableStandards
     BatchDisableStandards
     (NonEmpty Text)
     (NonEmpty Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDisableStandards' {NonEmpty Text
standardsSubscriptionArns :: NonEmpty Text
$sel:standardsSubscriptionArns:BatchDisableStandards' :: BatchDisableStandards -> NonEmpty Text
standardsSubscriptionArns} -> NonEmpty Text
standardsSubscriptionArns) (\s :: BatchDisableStandards
s@BatchDisableStandards' {} NonEmpty Text
a -> BatchDisableStandards
s {$sel:standardsSubscriptionArns:BatchDisableStandards' :: NonEmpty Text
standardsSubscriptionArns = NonEmpty Text
a} :: BatchDisableStandards) ((NonEmpty Text -> f (NonEmpty Text))
 -> BatchDisableStandards -> f BatchDisableStandards)
-> ((NonEmpty Text -> f (NonEmpty Text))
    -> NonEmpty Text -> f (NonEmpty Text))
-> (NonEmpty Text -> f (NonEmpty Text))
-> BatchDisableStandards
-> f BatchDisableStandards
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.AWSRequest BatchDisableStandards where
  type
    AWSResponse BatchDisableStandards =
      BatchDisableStandardsResponse
  request :: BatchDisableStandards -> Request BatchDisableStandards
request = Service -> BatchDisableStandards -> Request BatchDisableStandards
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy BatchDisableStandards
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse BatchDisableStandards)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse BatchDisableStandards))
-> Logger
-> Service
-> Proxy BatchDisableStandards
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse BatchDisableStandards)))
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 [StandardsSubscription]
-> Int -> BatchDisableStandardsResponse
BatchDisableStandardsResponse'
            (Maybe [StandardsSubscription]
 -> Int -> BatchDisableStandardsResponse)
-> Either String (Maybe [StandardsSubscription])
-> Either String (Int -> BatchDisableStandardsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object
-> Text -> Either String (Maybe (Maybe [StandardsSubscription]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"StandardsSubscriptions"
                            Either String (Maybe (Maybe [StandardsSubscription]))
-> Maybe [StandardsSubscription]
-> Either String (Maybe [StandardsSubscription])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [StandardsSubscription]
forall a. Monoid a => a
Prelude.mempty
                        )
            Either String (Int -> BatchDisableStandardsResponse)
-> Either String Int -> Either String BatchDisableStandardsResponse
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 BatchDisableStandards

instance Prelude.NFData BatchDisableStandards

instance Core.ToHeaders BatchDisableStandards where
  toHeaders :: BatchDisableStandards -> ResponseHeaders
toHeaders =
    ResponseHeaders -> BatchDisableStandards -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ 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 BatchDisableStandards where
  toJSON :: BatchDisableStandards -> Value
toJSON BatchDisableStandards' {NonEmpty Text
standardsSubscriptionArns :: NonEmpty Text
$sel:standardsSubscriptionArns:BatchDisableStandards' :: BatchDisableStandards -> NonEmpty 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
"StandardsSubscriptionArns"
                  Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty Text
standardsSubscriptionArns
              )
          ]
      )

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

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

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

-- |
-- Create a value of 'BatchDisableStandardsResponse' 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:
--
-- 'standardsSubscriptions', 'batchDisableStandardsResponse_standardsSubscriptions' - The details of the standards subscriptions that were disabled.
--
-- 'httpStatus', 'batchDisableStandardsResponse_httpStatus' - The response's http status code.
newBatchDisableStandardsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  BatchDisableStandardsResponse
newBatchDisableStandardsResponse :: Int -> BatchDisableStandardsResponse
newBatchDisableStandardsResponse Int
pHttpStatus_ =
  BatchDisableStandardsResponse' :: Maybe [StandardsSubscription]
-> Int -> BatchDisableStandardsResponse
BatchDisableStandardsResponse'
    { $sel:standardsSubscriptions:BatchDisableStandardsResponse' :: Maybe [StandardsSubscription]
standardsSubscriptions =
        Maybe [StandardsSubscription]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:BatchDisableStandardsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The details of the standards subscriptions that were disabled.
batchDisableStandardsResponse_standardsSubscriptions :: Lens.Lens' BatchDisableStandardsResponse (Prelude.Maybe [StandardsSubscription])
batchDisableStandardsResponse_standardsSubscriptions :: (Maybe [StandardsSubscription]
 -> f (Maybe [StandardsSubscription]))
-> BatchDisableStandardsResponse -> f BatchDisableStandardsResponse
batchDisableStandardsResponse_standardsSubscriptions = (BatchDisableStandardsResponse -> Maybe [StandardsSubscription])
-> (BatchDisableStandardsResponse
    -> Maybe [StandardsSubscription] -> BatchDisableStandardsResponse)
-> Lens
     BatchDisableStandardsResponse
     BatchDisableStandardsResponse
     (Maybe [StandardsSubscription])
     (Maybe [StandardsSubscription])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDisableStandardsResponse' {Maybe [StandardsSubscription]
standardsSubscriptions :: Maybe [StandardsSubscription]
$sel:standardsSubscriptions:BatchDisableStandardsResponse' :: BatchDisableStandardsResponse -> Maybe [StandardsSubscription]
standardsSubscriptions} -> Maybe [StandardsSubscription]
standardsSubscriptions) (\s :: BatchDisableStandardsResponse
s@BatchDisableStandardsResponse' {} Maybe [StandardsSubscription]
a -> BatchDisableStandardsResponse
s {$sel:standardsSubscriptions:BatchDisableStandardsResponse' :: Maybe [StandardsSubscription]
standardsSubscriptions = Maybe [StandardsSubscription]
a} :: BatchDisableStandardsResponse) ((Maybe [StandardsSubscription]
  -> f (Maybe [StandardsSubscription]))
 -> BatchDisableStandardsResponse
 -> f BatchDisableStandardsResponse)
-> ((Maybe [StandardsSubscription]
     -> f (Maybe [StandardsSubscription]))
    -> Maybe [StandardsSubscription]
    -> f (Maybe [StandardsSubscription]))
-> (Maybe [StandardsSubscription]
    -> f (Maybe [StandardsSubscription]))
-> BatchDisableStandardsResponse
-> f BatchDisableStandardsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [StandardsSubscription]
  [StandardsSubscription]
  [StandardsSubscription]
  [StandardsSubscription]
-> Iso
     (Maybe [StandardsSubscription])
     (Maybe [StandardsSubscription])
     (Maybe [StandardsSubscription])
     (Maybe [StandardsSubscription])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  [StandardsSubscription]
  [StandardsSubscription]
  [StandardsSubscription]
  [StandardsSubscription]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData BatchDisableStandardsResponse