{-# 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.DescribeHub
(
DescribeHub (..),
newDescribeHub,
describeHub_hubArn,
DescribeHubResponse (..),
newDescribeHubResponse,
describeHubResponse_autoEnableControls,
describeHubResponse_subscribedAt,
describeHubResponse_hubArn,
describeHubResponse_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 DescribeHub = DescribeHub'
{
DescribeHub -> Maybe Text
hubArn :: Prelude.Maybe Prelude.Text
}
deriving (DescribeHub -> DescribeHub -> Bool
(DescribeHub -> DescribeHub -> Bool)
-> (DescribeHub -> DescribeHub -> Bool) -> Eq DescribeHub
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeHub -> DescribeHub -> Bool
$c/= :: DescribeHub -> DescribeHub -> Bool
== :: DescribeHub -> DescribeHub -> Bool
$c== :: DescribeHub -> DescribeHub -> Bool
Prelude.Eq, ReadPrec [DescribeHub]
ReadPrec DescribeHub
Int -> ReadS DescribeHub
ReadS [DescribeHub]
(Int -> ReadS DescribeHub)
-> ReadS [DescribeHub]
-> ReadPrec DescribeHub
-> ReadPrec [DescribeHub]
-> Read DescribeHub
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeHub]
$creadListPrec :: ReadPrec [DescribeHub]
readPrec :: ReadPrec DescribeHub
$creadPrec :: ReadPrec DescribeHub
readList :: ReadS [DescribeHub]
$creadList :: ReadS [DescribeHub]
readsPrec :: Int -> ReadS DescribeHub
$creadsPrec :: Int -> ReadS DescribeHub
Prelude.Read, Int -> DescribeHub -> ShowS
[DescribeHub] -> ShowS
DescribeHub -> String
(Int -> DescribeHub -> ShowS)
-> (DescribeHub -> String)
-> ([DescribeHub] -> ShowS)
-> Show DescribeHub
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeHub] -> ShowS
$cshowList :: [DescribeHub] -> ShowS
show :: DescribeHub -> String
$cshow :: DescribeHub -> String
showsPrec :: Int -> DescribeHub -> ShowS
$cshowsPrec :: Int -> DescribeHub -> ShowS
Prelude.Show, (forall x. DescribeHub -> Rep DescribeHub x)
-> (forall x. Rep DescribeHub x -> DescribeHub)
-> Generic DescribeHub
forall x. Rep DescribeHub x -> DescribeHub
forall x. DescribeHub -> Rep DescribeHub x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeHub x -> DescribeHub
$cfrom :: forall x. DescribeHub -> Rep DescribeHub x
Prelude.Generic)
newDescribeHub ::
DescribeHub
newDescribeHub :: DescribeHub
newDescribeHub =
DescribeHub' :: Maybe Text -> DescribeHub
DescribeHub' {$sel:hubArn:DescribeHub' :: Maybe Text
hubArn = Maybe Text
forall a. Maybe a
Prelude.Nothing}
describeHub_hubArn :: Lens.Lens' DescribeHub (Prelude.Maybe Prelude.Text)
describeHub_hubArn :: (Maybe Text -> f (Maybe Text)) -> DescribeHub -> f DescribeHub
describeHub_hubArn = (DescribeHub -> Maybe Text)
-> (DescribeHub -> Maybe Text -> DescribeHub)
-> Lens DescribeHub DescribeHub (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeHub' {Maybe Text
hubArn :: Maybe Text
$sel:hubArn:DescribeHub' :: DescribeHub -> Maybe Text
hubArn} -> Maybe Text
hubArn) (\s :: DescribeHub
s@DescribeHub' {} Maybe Text
a -> DescribeHub
s {$sel:hubArn:DescribeHub' :: Maybe Text
hubArn = Maybe Text
a} :: DescribeHub)
instance Core.AWSRequest DescribeHub where
type AWSResponse DescribeHub = DescribeHubResponse
request :: DescribeHub -> Request DescribeHub
request = Service -> DescribeHub -> Request DescribeHub
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeHub
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeHub)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeHub))
-> Logger
-> Service
-> Proxy DescribeHub
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeHub)))
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 Bool
-> Maybe Text -> Maybe Text -> Int -> DescribeHubResponse
DescribeHubResponse'
(Maybe Bool
-> Maybe Text -> Maybe Text -> Int -> DescribeHubResponse)
-> Either String (Maybe Bool)
-> Either
String (Maybe Text -> Maybe Text -> Int -> DescribeHubResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"AutoEnableControls")
Either
String (Maybe Text -> Maybe Text -> Int -> DescribeHubResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> DescribeHubResponse)
forall (f :: * -> *) a b. Applicative f => 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
"SubscribedAt")
Either String (Maybe Text -> Int -> DescribeHubResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DescribeHubResponse)
forall (f :: * -> *) a b. Applicative f => 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
"HubArn")
Either String (Int -> DescribeHubResponse)
-> Either String Int -> Either String DescribeHubResponse
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 DescribeHub
instance Prelude.NFData DescribeHub
instance Core.ToHeaders DescribeHub where
toHeaders :: DescribeHub -> ResponseHeaders
toHeaders =
ResponseHeaders -> DescribeHub -> 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.ToPath DescribeHub where
toPath :: DescribeHub -> ByteString
toPath = ByteString -> DescribeHub -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/accounts"
instance Core.ToQuery DescribeHub where
toQuery :: DescribeHub -> QueryString
toQuery DescribeHub' {Maybe Text
hubArn :: Maybe Text
$sel:hubArn:DescribeHub' :: DescribeHub -> Maybe Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"HubArn" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
hubArn]
data DescribeHubResponse = DescribeHubResponse'
{
DescribeHubResponse -> Maybe Bool
autoEnableControls :: Prelude.Maybe Prelude.Bool,
DescribeHubResponse -> Maybe Text
subscribedAt :: Prelude.Maybe Prelude.Text,
DescribeHubResponse -> Maybe Text
hubArn :: Prelude.Maybe Prelude.Text,
DescribeHubResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeHubResponse -> DescribeHubResponse -> Bool
(DescribeHubResponse -> DescribeHubResponse -> Bool)
-> (DescribeHubResponse -> DescribeHubResponse -> Bool)
-> Eq DescribeHubResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeHubResponse -> DescribeHubResponse -> Bool
$c/= :: DescribeHubResponse -> DescribeHubResponse -> Bool
== :: DescribeHubResponse -> DescribeHubResponse -> Bool
$c== :: DescribeHubResponse -> DescribeHubResponse -> Bool
Prelude.Eq, ReadPrec [DescribeHubResponse]
ReadPrec DescribeHubResponse
Int -> ReadS DescribeHubResponse
ReadS [DescribeHubResponse]
(Int -> ReadS DescribeHubResponse)
-> ReadS [DescribeHubResponse]
-> ReadPrec DescribeHubResponse
-> ReadPrec [DescribeHubResponse]
-> Read DescribeHubResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeHubResponse]
$creadListPrec :: ReadPrec [DescribeHubResponse]
readPrec :: ReadPrec DescribeHubResponse
$creadPrec :: ReadPrec DescribeHubResponse
readList :: ReadS [DescribeHubResponse]
$creadList :: ReadS [DescribeHubResponse]
readsPrec :: Int -> ReadS DescribeHubResponse
$creadsPrec :: Int -> ReadS DescribeHubResponse
Prelude.Read, Int -> DescribeHubResponse -> ShowS
[DescribeHubResponse] -> ShowS
DescribeHubResponse -> String
(Int -> DescribeHubResponse -> ShowS)
-> (DescribeHubResponse -> String)
-> ([DescribeHubResponse] -> ShowS)
-> Show DescribeHubResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeHubResponse] -> ShowS
$cshowList :: [DescribeHubResponse] -> ShowS
show :: DescribeHubResponse -> String
$cshow :: DescribeHubResponse -> String
showsPrec :: Int -> DescribeHubResponse -> ShowS
$cshowsPrec :: Int -> DescribeHubResponse -> ShowS
Prelude.Show, (forall x. DescribeHubResponse -> Rep DescribeHubResponse x)
-> (forall x. Rep DescribeHubResponse x -> DescribeHubResponse)
-> Generic DescribeHubResponse
forall x. Rep DescribeHubResponse x -> DescribeHubResponse
forall x. DescribeHubResponse -> Rep DescribeHubResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeHubResponse x -> DescribeHubResponse
$cfrom :: forall x. DescribeHubResponse -> Rep DescribeHubResponse x
Prelude.Generic)
newDescribeHubResponse ::
Prelude.Int ->
DescribeHubResponse
newDescribeHubResponse :: Int -> DescribeHubResponse
newDescribeHubResponse Int
pHttpStatus_ =
DescribeHubResponse' :: Maybe Bool
-> Maybe Text -> Maybe Text -> Int -> DescribeHubResponse
DescribeHubResponse'
{ $sel:autoEnableControls:DescribeHubResponse' :: Maybe Bool
autoEnableControls =
Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:subscribedAt:DescribeHubResponse' :: Maybe Text
subscribedAt = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:hubArn:DescribeHubResponse' :: Maybe Text
hubArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeHubResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeHubResponse_autoEnableControls :: Lens.Lens' DescribeHubResponse (Prelude.Maybe Prelude.Bool)
describeHubResponse_autoEnableControls :: (Maybe Bool -> f (Maybe Bool))
-> DescribeHubResponse -> f DescribeHubResponse
describeHubResponse_autoEnableControls = (DescribeHubResponse -> Maybe Bool)
-> (DescribeHubResponse -> Maybe Bool -> DescribeHubResponse)
-> Lens
DescribeHubResponse DescribeHubResponse (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeHubResponse' {Maybe Bool
autoEnableControls :: Maybe Bool
$sel:autoEnableControls:DescribeHubResponse' :: DescribeHubResponse -> Maybe Bool
autoEnableControls} -> Maybe Bool
autoEnableControls) (\s :: DescribeHubResponse
s@DescribeHubResponse' {} Maybe Bool
a -> DescribeHubResponse
s {$sel:autoEnableControls:DescribeHubResponse' :: Maybe Bool
autoEnableControls = Maybe Bool
a} :: DescribeHubResponse)
describeHubResponse_subscribedAt :: Lens.Lens' DescribeHubResponse (Prelude.Maybe Prelude.Text)
describeHubResponse_subscribedAt :: (Maybe Text -> f (Maybe Text))
-> DescribeHubResponse -> f DescribeHubResponse
describeHubResponse_subscribedAt = (DescribeHubResponse -> Maybe Text)
-> (DescribeHubResponse -> Maybe Text -> DescribeHubResponse)
-> Lens
DescribeHubResponse DescribeHubResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeHubResponse' {Maybe Text
subscribedAt :: Maybe Text
$sel:subscribedAt:DescribeHubResponse' :: DescribeHubResponse -> Maybe Text
subscribedAt} -> Maybe Text
subscribedAt) (\s :: DescribeHubResponse
s@DescribeHubResponse' {} Maybe Text
a -> DescribeHubResponse
s {$sel:subscribedAt:DescribeHubResponse' :: Maybe Text
subscribedAt = Maybe Text
a} :: DescribeHubResponse)
describeHubResponse_hubArn :: Lens.Lens' DescribeHubResponse (Prelude.Maybe Prelude.Text)
describeHubResponse_hubArn :: (Maybe Text -> f (Maybe Text))
-> DescribeHubResponse -> f DescribeHubResponse
describeHubResponse_hubArn = (DescribeHubResponse -> Maybe Text)
-> (DescribeHubResponse -> Maybe Text -> DescribeHubResponse)
-> Lens
DescribeHubResponse DescribeHubResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeHubResponse' {Maybe Text
hubArn :: Maybe Text
$sel:hubArn:DescribeHubResponse' :: DescribeHubResponse -> Maybe Text
hubArn} -> Maybe Text
hubArn) (\s :: DescribeHubResponse
s@DescribeHubResponse' {} Maybe Text
a -> DescribeHubResponse
s {$sel:hubArn:DescribeHubResponse' :: Maybe Text
hubArn = Maybe Text
a} :: DescribeHubResponse)
describeHubResponse_httpStatus :: Lens.Lens' DescribeHubResponse Prelude.Int
describeHubResponse_httpStatus :: (Int -> f Int) -> DescribeHubResponse -> f DescribeHubResponse
describeHubResponse_httpStatus = (DescribeHubResponse -> Int)
-> (DescribeHubResponse -> Int -> DescribeHubResponse)
-> Lens DescribeHubResponse DescribeHubResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeHubResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeHubResponse' :: DescribeHubResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeHubResponse
s@DescribeHubResponse' {} Int
a -> DescribeHubResponse
s {$sel:httpStatus:DescribeHubResponse' :: Int
httpStatus = Int
a} :: DescribeHubResponse)
instance Prelude.NFData DescribeHubResponse