{-# 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 #-}
module Amazonka.SecurityHub.BatchEnableStandards
(
BatchEnableStandards (..),
newBatchEnableStandards,
batchEnableStandards_standardsSubscriptionRequests,
BatchEnableStandardsResponse (..),
newBatchEnableStandardsResponse,
batchEnableStandardsResponse_standardsSubscriptions,
batchEnableStandardsResponse_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
data BatchEnableStandards = BatchEnableStandards'
{
BatchEnableStandards -> NonEmpty StandardsSubscriptionRequest
standardsSubscriptionRequests :: Prelude.NonEmpty StandardsSubscriptionRequest
}
deriving (BatchEnableStandards -> BatchEnableStandards -> Bool
(BatchEnableStandards -> BatchEnableStandards -> Bool)
-> (BatchEnableStandards -> BatchEnableStandards -> Bool)
-> Eq BatchEnableStandards
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchEnableStandards -> BatchEnableStandards -> Bool
$c/= :: BatchEnableStandards -> BatchEnableStandards -> Bool
== :: BatchEnableStandards -> BatchEnableStandards -> Bool
$c== :: BatchEnableStandards -> BatchEnableStandards -> Bool
Prelude.Eq, ReadPrec [BatchEnableStandards]
ReadPrec BatchEnableStandards
Int -> ReadS BatchEnableStandards
ReadS [BatchEnableStandards]
(Int -> ReadS BatchEnableStandards)
-> ReadS [BatchEnableStandards]
-> ReadPrec BatchEnableStandards
-> ReadPrec [BatchEnableStandards]
-> Read BatchEnableStandards
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchEnableStandards]
$creadListPrec :: ReadPrec [BatchEnableStandards]
readPrec :: ReadPrec BatchEnableStandards
$creadPrec :: ReadPrec BatchEnableStandards
readList :: ReadS [BatchEnableStandards]
$creadList :: ReadS [BatchEnableStandards]
readsPrec :: Int -> ReadS BatchEnableStandards
$creadsPrec :: Int -> ReadS BatchEnableStandards
Prelude.Read, Int -> BatchEnableStandards -> ShowS
[BatchEnableStandards] -> ShowS
BatchEnableStandards -> String
(Int -> BatchEnableStandards -> ShowS)
-> (BatchEnableStandards -> String)
-> ([BatchEnableStandards] -> ShowS)
-> Show BatchEnableStandards
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchEnableStandards] -> ShowS
$cshowList :: [BatchEnableStandards] -> ShowS
show :: BatchEnableStandards -> String
$cshow :: BatchEnableStandards -> String
showsPrec :: Int -> BatchEnableStandards -> ShowS
$cshowsPrec :: Int -> BatchEnableStandards -> ShowS
Prelude.Show, (forall x. BatchEnableStandards -> Rep BatchEnableStandards x)
-> (forall x. Rep BatchEnableStandards x -> BatchEnableStandards)
-> Generic BatchEnableStandards
forall x. Rep BatchEnableStandards x -> BatchEnableStandards
forall x. BatchEnableStandards -> Rep BatchEnableStandards x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BatchEnableStandards x -> BatchEnableStandards
$cfrom :: forall x. BatchEnableStandards -> Rep BatchEnableStandards x
Prelude.Generic)
newBatchEnableStandards ::
Prelude.NonEmpty StandardsSubscriptionRequest ->
BatchEnableStandards
newBatchEnableStandards :: NonEmpty StandardsSubscriptionRequest -> BatchEnableStandards
newBatchEnableStandards
NonEmpty StandardsSubscriptionRequest
pStandardsSubscriptionRequests_ =
BatchEnableStandards' :: NonEmpty StandardsSubscriptionRequest -> BatchEnableStandards
BatchEnableStandards'
{ $sel:standardsSubscriptionRequests:BatchEnableStandards' :: NonEmpty StandardsSubscriptionRequest
standardsSubscriptionRequests =
Tagged
(NonEmpty StandardsSubscriptionRequest)
(Identity (NonEmpty StandardsSubscriptionRequest))
-> Tagged
(NonEmpty StandardsSubscriptionRequest)
(Identity (NonEmpty StandardsSubscriptionRequest))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged
(NonEmpty StandardsSubscriptionRequest)
(Identity (NonEmpty StandardsSubscriptionRequest))
-> Tagged
(NonEmpty StandardsSubscriptionRequest)
(Identity (NonEmpty StandardsSubscriptionRequest)))
-> NonEmpty StandardsSubscriptionRequest
-> NonEmpty StandardsSubscriptionRequest
forall t b. AReview t b -> b -> t
Lens.# NonEmpty StandardsSubscriptionRequest
pStandardsSubscriptionRequests_
}
batchEnableStandards_standardsSubscriptionRequests :: Lens.Lens' BatchEnableStandards (Prelude.NonEmpty StandardsSubscriptionRequest)
batchEnableStandards_standardsSubscriptionRequests :: (NonEmpty StandardsSubscriptionRequest
-> f (NonEmpty StandardsSubscriptionRequest))
-> BatchEnableStandards -> f BatchEnableStandards
batchEnableStandards_standardsSubscriptionRequests = (BatchEnableStandards -> NonEmpty StandardsSubscriptionRequest)
-> (BatchEnableStandards
-> NonEmpty StandardsSubscriptionRequest -> BatchEnableStandards)
-> Lens
BatchEnableStandards
BatchEnableStandards
(NonEmpty StandardsSubscriptionRequest)
(NonEmpty StandardsSubscriptionRequest)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchEnableStandards' {NonEmpty StandardsSubscriptionRequest
standardsSubscriptionRequests :: NonEmpty StandardsSubscriptionRequest
$sel:standardsSubscriptionRequests:BatchEnableStandards' :: BatchEnableStandards -> NonEmpty StandardsSubscriptionRequest
standardsSubscriptionRequests} -> NonEmpty StandardsSubscriptionRequest
standardsSubscriptionRequests) (\s :: BatchEnableStandards
s@BatchEnableStandards' {} NonEmpty StandardsSubscriptionRequest
a -> BatchEnableStandards
s {$sel:standardsSubscriptionRequests:BatchEnableStandards' :: NonEmpty StandardsSubscriptionRequest
standardsSubscriptionRequests = NonEmpty StandardsSubscriptionRequest
a} :: BatchEnableStandards) ((NonEmpty StandardsSubscriptionRequest
-> f (NonEmpty StandardsSubscriptionRequest))
-> BatchEnableStandards -> f BatchEnableStandards)
-> ((NonEmpty StandardsSubscriptionRequest
-> f (NonEmpty StandardsSubscriptionRequest))
-> NonEmpty StandardsSubscriptionRequest
-> f (NonEmpty StandardsSubscriptionRequest))
-> (NonEmpty StandardsSubscriptionRequest
-> f (NonEmpty StandardsSubscriptionRequest))
-> BatchEnableStandards
-> f BatchEnableStandards
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty StandardsSubscriptionRequest
-> f (NonEmpty StandardsSubscriptionRequest))
-> NonEmpty StandardsSubscriptionRequest
-> f (NonEmpty StandardsSubscriptionRequest)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest BatchEnableStandards where
type
AWSResponse BatchEnableStandards =
BatchEnableStandardsResponse
request :: BatchEnableStandards -> Request BatchEnableStandards
request = Service -> BatchEnableStandards -> Request BatchEnableStandards
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy BatchEnableStandards
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse BatchEnableStandards)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse BatchEnableStandards))
-> Logger
-> Service
-> Proxy BatchEnableStandards
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse BatchEnableStandards)))
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 -> BatchEnableStandardsResponse
BatchEnableStandardsResponse'
(Maybe [StandardsSubscription]
-> Int -> BatchEnableStandardsResponse)
-> Either String (Maybe [StandardsSubscription])
-> Either String (Int -> BatchEnableStandardsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object
-> Key -> Either String (Maybe (Maybe [StandardsSubscription]))
forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Core..?> Key
"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 -> BatchEnableStandardsResponse)
-> Either String Int -> Either String BatchEnableStandardsResponse
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 BatchEnableStandards
instance Prelude.NFData BatchEnableStandards
instance Core.ToHeaders BatchEnableStandards where
toHeaders :: BatchEnableStandards -> ResponseHeaders
toHeaders =
ResponseHeaders -> BatchEnableStandards -> 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 BatchEnableStandards where
toJSON :: BatchEnableStandards -> Value
toJSON BatchEnableStandards' {NonEmpty StandardsSubscriptionRequest
standardsSubscriptionRequests :: NonEmpty StandardsSubscriptionRequest
$sel:standardsSubscriptionRequests:BatchEnableStandards' :: BatchEnableStandards -> NonEmpty StandardsSubscriptionRequest
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Key
"StandardsSubscriptionRequests"
Key -> NonEmpty StandardsSubscriptionRequest -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Core..= NonEmpty StandardsSubscriptionRequest
standardsSubscriptionRequests
)
]
)
instance Core.ToPath BatchEnableStandards where
toPath :: BatchEnableStandards -> ByteString
toPath = ByteString -> BatchEnableStandards -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/standards/register"
instance Core.ToQuery BatchEnableStandards where
toQuery :: BatchEnableStandards -> QueryString
toQuery = QueryString -> BatchEnableStandards -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data BatchEnableStandardsResponse = BatchEnableStandardsResponse'
{
BatchEnableStandardsResponse -> Maybe [StandardsSubscription]
standardsSubscriptions :: Prelude.Maybe [StandardsSubscription],
BatchEnableStandardsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (BatchEnableStandardsResponse
-> BatchEnableStandardsResponse -> Bool
(BatchEnableStandardsResponse
-> BatchEnableStandardsResponse -> Bool)
-> (BatchEnableStandardsResponse
-> BatchEnableStandardsResponse -> Bool)
-> Eq BatchEnableStandardsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchEnableStandardsResponse
-> BatchEnableStandardsResponse -> Bool
$c/= :: BatchEnableStandardsResponse
-> BatchEnableStandardsResponse -> Bool
== :: BatchEnableStandardsResponse
-> BatchEnableStandardsResponse -> Bool
$c== :: BatchEnableStandardsResponse
-> BatchEnableStandardsResponse -> Bool
Prelude.Eq, ReadPrec [BatchEnableStandardsResponse]
ReadPrec BatchEnableStandardsResponse
Int -> ReadS BatchEnableStandardsResponse
ReadS [BatchEnableStandardsResponse]
(Int -> ReadS BatchEnableStandardsResponse)
-> ReadS [BatchEnableStandardsResponse]
-> ReadPrec BatchEnableStandardsResponse
-> ReadPrec [BatchEnableStandardsResponse]
-> Read BatchEnableStandardsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchEnableStandardsResponse]
$creadListPrec :: ReadPrec [BatchEnableStandardsResponse]
readPrec :: ReadPrec BatchEnableStandardsResponse
$creadPrec :: ReadPrec BatchEnableStandardsResponse
readList :: ReadS [BatchEnableStandardsResponse]
$creadList :: ReadS [BatchEnableStandardsResponse]
readsPrec :: Int -> ReadS BatchEnableStandardsResponse
$creadsPrec :: Int -> ReadS BatchEnableStandardsResponse
Prelude.Read, Int -> BatchEnableStandardsResponse -> ShowS
[BatchEnableStandardsResponse] -> ShowS
BatchEnableStandardsResponse -> String
(Int -> BatchEnableStandardsResponse -> ShowS)
-> (BatchEnableStandardsResponse -> String)
-> ([BatchEnableStandardsResponse] -> ShowS)
-> Show BatchEnableStandardsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchEnableStandardsResponse] -> ShowS
$cshowList :: [BatchEnableStandardsResponse] -> ShowS
show :: BatchEnableStandardsResponse -> String
$cshow :: BatchEnableStandardsResponse -> String
showsPrec :: Int -> BatchEnableStandardsResponse -> ShowS
$cshowsPrec :: Int -> BatchEnableStandardsResponse -> ShowS
Prelude.Show, (forall x.
BatchEnableStandardsResponse -> Rep BatchEnableStandardsResponse x)
-> (forall x.
Rep BatchEnableStandardsResponse x -> BatchEnableStandardsResponse)
-> Generic BatchEnableStandardsResponse
forall x.
Rep BatchEnableStandardsResponse x -> BatchEnableStandardsResponse
forall x.
BatchEnableStandardsResponse -> Rep BatchEnableStandardsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchEnableStandardsResponse x -> BatchEnableStandardsResponse
$cfrom :: forall x.
BatchEnableStandardsResponse -> Rep BatchEnableStandardsResponse x
Prelude.Generic)
newBatchEnableStandardsResponse ::
Prelude.Int ->
BatchEnableStandardsResponse
newBatchEnableStandardsResponse :: Int -> BatchEnableStandardsResponse
newBatchEnableStandardsResponse Int
pHttpStatus_ =
BatchEnableStandardsResponse' :: Maybe [StandardsSubscription]
-> Int -> BatchEnableStandardsResponse
BatchEnableStandardsResponse'
{ $sel:standardsSubscriptions:BatchEnableStandardsResponse' :: Maybe [StandardsSubscription]
standardsSubscriptions =
Maybe [StandardsSubscription]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:BatchEnableStandardsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
batchEnableStandardsResponse_standardsSubscriptions :: Lens.Lens' BatchEnableStandardsResponse (Prelude.Maybe [StandardsSubscription])
batchEnableStandardsResponse_standardsSubscriptions :: (Maybe [StandardsSubscription]
-> f (Maybe [StandardsSubscription]))
-> BatchEnableStandardsResponse -> f BatchEnableStandardsResponse
batchEnableStandardsResponse_standardsSubscriptions = (BatchEnableStandardsResponse -> Maybe [StandardsSubscription])
-> (BatchEnableStandardsResponse
-> Maybe [StandardsSubscription] -> BatchEnableStandardsResponse)
-> Lens
BatchEnableStandardsResponse
BatchEnableStandardsResponse
(Maybe [StandardsSubscription])
(Maybe [StandardsSubscription])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchEnableStandardsResponse' {Maybe [StandardsSubscription]
standardsSubscriptions :: Maybe [StandardsSubscription]
$sel:standardsSubscriptions:BatchEnableStandardsResponse' :: BatchEnableStandardsResponse -> Maybe [StandardsSubscription]
standardsSubscriptions} -> Maybe [StandardsSubscription]
standardsSubscriptions) (\s :: BatchEnableStandardsResponse
s@BatchEnableStandardsResponse' {} Maybe [StandardsSubscription]
a -> BatchEnableStandardsResponse
s {$sel:standardsSubscriptions:BatchEnableStandardsResponse' :: Maybe [StandardsSubscription]
standardsSubscriptions = Maybe [StandardsSubscription]
a} :: BatchEnableStandardsResponse) ((Maybe [StandardsSubscription]
-> f (Maybe [StandardsSubscription]))
-> BatchEnableStandardsResponse -> f BatchEnableStandardsResponse)
-> ((Maybe [StandardsSubscription]
-> f (Maybe [StandardsSubscription]))
-> Maybe [StandardsSubscription]
-> f (Maybe [StandardsSubscription]))
-> (Maybe [StandardsSubscription]
-> f (Maybe [StandardsSubscription]))
-> BatchEnableStandardsResponse
-> f BatchEnableStandardsResponse
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
batchEnableStandardsResponse_httpStatus :: Lens.Lens' BatchEnableStandardsResponse Prelude.Int
batchEnableStandardsResponse_httpStatus :: (Int -> f Int)
-> BatchEnableStandardsResponse -> f BatchEnableStandardsResponse
batchEnableStandardsResponse_httpStatus = (BatchEnableStandardsResponse -> Int)
-> (BatchEnableStandardsResponse
-> Int -> BatchEnableStandardsResponse)
-> Lens
BatchEnableStandardsResponse BatchEnableStandardsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchEnableStandardsResponse' {Int
httpStatus :: Int
$sel:httpStatus:BatchEnableStandardsResponse' :: BatchEnableStandardsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: BatchEnableStandardsResponse
s@BatchEnableStandardsResponse' {} Int
a -> BatchEnableStandardsResponse
s {$sel:httpStatus:BatchEnableStandardsResponse' :: Int
httpStatus = Int
a} :: BatchEnableStandardsResponse)
instance Prelude.NFData BatchEnableStandardsResponse