{-# 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.GuardDuty.GetIPSet
(
GetIPSet (..),
newGetIPSet,
getIPSet_detectorId,
getIPSet_ipSetId,
GetIPSetResponse (..),
newGetIPSetResponse,
getIPSetResponse_tags,
getIPSetResponse_httpStatus,
getIPSetResponse_name,
getIPSetResponse_format,
getIPSetResponse_location,
getIPSetResponse_status,
)
where
import qualified Amazonka.Core as Core
import Amazonka.GuardDuty.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetIPSet = GetIPSet'
{
GetIPSet -> Text
detectorId :: Prelude.Text,
GetIPSet -> Text
ipSetId :: Prelude.Text
}
deriving (GetIPSet -> GetIPSet -> Bool
(GetIPSet -> GetIPSet -> Bool)
-> (GetIPSet -> GetIPSet -> Bool) -> Eq GetIPSet
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetIPSet -> GetIPSet -> Bool
$c/= :: GetIPSet -> GetIPSet -> Bool
== :: GetIPSet -> GetIPSet -> Bool
$c== :: GetIPSet -> GetIPSet -> Bool
Prelude.Eq, ReadPrec [GetIPSet]
ReadPrec GetIPSet
Int -> ReadS GetIPSet
ReadS [GetIPSet]
(Int -> ReadS GetIPSet)
-> ReadS [GetIPSet]
-> ReadPrec GetIPSet
-> ReadPrec [GetIPSet]
-> Read GetIPSet
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetIPSet]
$creadListPrec :: ReadPrec [GetIPSet]
readPrec :: ReadPrec GetIPSet
$creadPrec :: ReadPrec GetIPSet
readList :: ReadS [GetIPSet]
$creadList :: ReadS [GetIPSet]
readsPrec :: Int -> ReadS GetIPSet
$creadsPrec :: Int -> ReadS GetIPSet
Prelude.Read, Int -> GetIPSet -> ShowS
[GetIPSet] -> ShowS
GetIPSet -> String
(Int -> GetIPSet -> ShowS)
-> (GetIPSet -> String) -> ([GetIPSet] -> ShowS) -> Show GetIPSet
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetIPSet] -> ShowS
$cshowList :: [GetIPSet] -> ShowS
show :: GetIPSet -> String
$cshow :: GetIPSet -> String
showsPrec :: Int -> GetIPSet -> ShowS
$cshowsPrec :: Int -> GetIPSet -> ShowS
Prelude.Show, (forall x. GetIPSet -> Rep GetIPSet x)
-> (forall x. Rep GetIPSet x -> GetIPSet) -> Generic GetIPSet
forall x. Rep GetIPSet x -> GetIPSet
forall x. GetIPSet -> Rep GetIPSet x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetIPSet x -> GetIPSet
$cfrom :: forall x. GetIPSet -> Rep GetIPSet x
Prelude.Generic)
newGetIPSet ::
Prelude.Text ->
Prelude.Text ->
GetIPSet
newGetIPSet :: Text -> Text -> GetIPSet
newGetIPSet Text
pDetectorId_ Text
pIpSetId_ =
GetIPSet' :: Text -> Text -> GetIPSet
GetIPSet'
{ $sel:detectorId:GetIPSet' :: Text
detectorId = Text
pDetectorId_,
$sel:ipSetId:GetIPSet' :: Text
ipSetId = Text
pIpSetId_
}
getIPSet_detectorId :: Lens.Lens' GetIPSet Prelude.Text
getIPSet_detectorId :: (Text -> f Text) -> GetIPSet -> f GetIPSet
getIPSet_detectorId = (GetIPSet -> Text)
-> (GetIPSet -> Text -> GetIPSet)
-> Lens GetIPSet GetIPSet Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetIPSet' {Text
detectorId :: Text
$sel:detectorId:GetIPSet' :: GetIPSet -> Text
detectorId} -> Text
detectorId) (\s :: GetIPSet
s@GetIPSet' {} Text
a -> GetIPSet
s {$sel:detectorId:GetIPSet' :: Text
detectorId = Text
a} :: GetIPSet)
getIPSet_ipSetId :: Lens.Lens' GetIPSet Prelude.Text
getIPSet_ipSetId :: (Text -> f Text) -> GetIPSet -> f GetIPSet
getIPSet_ipSetId = (GetIPSet -> Text)
-> (GetIPSet -> Text -> GetIPSet)
-> Lens GetIPSet GetIPSet Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetIPSet' {Text
ipSetId :: Text
$sel:ipSetId:GetIPSet' :: GetIPSet -> Text
ipSetId} -> Text
ipSetId) (\s :: GetIPSet
s@GetIPSet' {} Text
a -> GetIPSet
s {$sel:ipSetId:GetIPSet' :: Text
ipSetId = Text
a} :: GetIPSet)
instance Core.AWSRequest GetIPSet where
type AWSResponse GetIPSet = GetIPSetResponse
request :: GetIPSet -> Request GetIPSet
request = Service -> GetIPSet -> Request GetIPSet
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetIPSet
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetIPSet)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetIPSet))
-> Logger
-> Service
-> Proxy GetIPSet
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetIPSet)))
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 (HashMap Text Text)
-> Int
-> Text
-> IpSetFormat
-> Text
-> IpSetStatus
-> GetIPSetResponse
GetIPSetResponse'
(Maybe (HashMap Text Text)
-> Int
-> Text
-> IpSetFormat
-> Text
-> IpSetStatus
-> GetIPSetResponse)
-> Either String (Maybe (HashMap Text Text))
-> Either
String
(Int
-> Text -> IpSetFormat -> Text -> IpSetStatus -> GetIPSetResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"tags" Either String (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text)
-> Either String (Maybe (HashMap Text Text))
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
Either
String
(Int
-> Text -> IpSetFormat -> Text -> IpSetStatus -> GetIPSetResponse)
-> Either String Int
-> Either
String
(Text -> IpSetFormat -> Text -> IpSetStatus -> GetIPSetResponse)
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))
Either
String
(Text -> IpSetFormat -> Text -> IpSetStatus -> GetIPSetResponse)
-> Either String Text
-> Either
String (IpSetFormat -> Text -> IpSetStatus -> GetIPSetResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Text
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"name")
Either
String (IpSetFormat -> Text -> IpSetStatus -> GetIPSetResponse)
-> Either String IpSetFormat
-> Either String (Text -> IpSetStatus -> GetIPSetResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String IpSetFormat
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"format")
Either String (Text -> IpSetStatus -> GetIPSetResponse)
-> Either String Text
-> Either String (IpSetStatus -> GetIPSetResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Text
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"location")
Either String (IpSetStatus -> GetIPSetResponse)
-> Either String IpSetStatus -> Either String GetIPSetResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String IpSetStatus
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"status")
)
instance Prelude.Hashable GetIPSet
instance Prelude.NFData GetIPSet
instance Core.ToHeaders GetIPSet where
toHeaders :: GetIPSet -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetIPSet -> 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 GetIPSet where
toPath :: GetIPSet -> ByteString
toPath GetIPSet' {Text
ipSetId :: Text
detectorId :: Text
$sel:ipSetId:GetIPSet' :: GetIPSet -> Text
$sel:detectorId:GetIPSet' :: GetIPSet -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/detector/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
detectorId,
ByteString
"/ipset/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
ipSetId
]
instance Core.ToQuery GetIPSet where
toQuery :: GetIPSet -> QueryString
toQuery = QueryString -> GetIPSet -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetIPSetResponse = GetIPSetResponse'
{
GetIPSetResponse -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
GetIPSetResponse -> Int
httpStatus :: Prelude.Int,
GetIPSetResponse -> Text
name :: Prelude.Text,
GetIPSetResponse -> IpSetFormat
format :: IpSetFormat,
GetIPSetResponse -> Text
location :: Prelude.Text,
GetIPSetResponse -> IpSetStatus
status :: IpSetStatus
}
deriving (GetIPSetResponse -> GetIPSetResponse -> Bool
(GetIPSetResponse -> GetIPSetResponse -> Bool)
-> (GetIPSetResponse -> GetIPSetResponse -> Bool)
-> Eq GetIPSetResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetIPSetResponse -> GetIPSetResponse -> Bool
$c/= :: GetIPSetResponse -> GetIPSetResponse -> Bool
== :: GetIPSetResponse -> GetIPSetResponse -> Bool
$c== :: GetIPSetResponse -> GetIPSetResponse -> Bool
Prelude.Eq, ReadPrec [GetIPSetResponse]
ReadPrec GetIPSetResponse
Int -> ReadS GetIPSetResponse
ReadS [GetIPSetResponse]
(Int -> ReadS GetIPSetResponse)
-> ReadS [GetIPSetResponse]
-> ReadPrec GetIPSetResponse
-> ReadPrec [GetIPSetResponse]
-> Read GetIPSetResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetIPSetResponse]
$creadListPrec :: ReadPrec [GetIPSetResponse]
readPrec :: ReadPrec GetIPSetResponse
$creadPrec :: ReadPrec GetIPSetResponse
readList :: ReadS [GetIPSetResponse]
$creadList :: ReadS [GetIPSetResponse]
readsPrec :: Int -> ReadS GetIPSetResponse
$creadsPrec :: Int -> ReadS GetIPSetResponse
Prelude.Read, Int -> GetIPSetResponse -> ShowS
[GetIPSetResponse] -> ShowS
GetIPSetResponse -> String
(Int -> GetIPSetResponse -> ShowS)
-> (GetIPSetResponse -> String)
-> ([GetIPSetResponse] -> ShowS)
-> Show GetIPSetResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetIPSetResponse] -> ShowS
$cshowList :: [GetIPSetResponse] -> ShowS
show :: GetIPSetResponse -> String
$cshow :: GetIPSetResponse -> String
showsPrec :: Int -> GetIPSetResponse -> ShowS
$cshowsPrec :: Int -> GetIPSetResponse -> ShowS
Prelude.Show, (forall x. GetIPSetResponse -> Rep GetIPSetResponse x)
-> (forall x. Rep GetIPSetResponse x -> GetIPSetResponse)
-> Generic GetIPSetResponse
forall x. Rep GetIPSetResponse x -> GetIPSetResponse
forall x. GetIPSetResponse -> Rep GetIPSetResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetIPSetResponse x -> GetIPSetResponse
$cfrom :: forall x. GetIPSetResponse -> Rep GetIPSetResponse x
Prelude.Generic)
newGetIPSetResponse ::
Prelude.Int ->
Prelude.Text ->
IpSetFormat ->
Prelude.Text ->
IpSetStatus ->
GetIPSetResponse
newGetIPSetResponse :: Int
-> Text -> IpSetFormat -> Text -> IpSetStatus -> GetIPSetResponse
newGetIPSetResponse
Int
pHttpStatus_
Text
pName_
IpSetFormat
pFormat_
Text
pLocation_
IpSetStatus
pStatus_ =
GetIPSetResponse' :: Maybe (HashMap Text Text)
-> Int
-> Text
-> IpSetFormat
-> Text
-> IpSetStatus
-> GetIPSetResponse
GetIPSetResponse'
{ $sel:tags:GetIPSetResponse' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetIPSetResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:name:GetIPSetResponse' :: Text
name = Text
pName_,
$sel:format:GetIPSetResponse' :: IpSetFormat
format = IpSetFormat
pFormat_,
$sel:location:GetIPSetResponse' :: Text
location = Text
pLocation_,
$sel:status:GetIPSetResponse' :: IpSetStatus
status = IpSetStatus
pStatus_
}
getIPSetResponse_tags :: Lens.Lens' GetIPSetResponse (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
getIPSetResponse_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> GetIPSetResponse -> f GetIPSetResponse
getIPSetResponse_tags = (GetIPSetResponse -> Maybe (HashMap Text Text))
-> (GetIPSetResponse
-> Maybe (HashMap Text Text) -> GetIPSetResponse)
-> Lens
GetIPSetResponse
GetIPSetResponse
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetIPSetResponse' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:GetIPSetResponse' :: GetIPSetResponse -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: GetIPSetResponse
s@GetIPSetResponse' {} Maybe (HashMap Text Text)
a -> GetIPSetResponse
s {$sel:tags:GetIPSetResponse' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: GetIPSetResponse) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> GetIPSetResponse -> f GetIPSetResponse)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> GetIPSetResponse
-> f GetIPSetResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
-> Iso
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
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
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getIPSetResponse_httpStatus :: Lens.Lens' GetIPSetResponse Prelude.Int
getIPSetResponse_httpStatus :: (Int -> f Int) -> GetIPSetResponse -> f GetIPSetResponse
getIPSetResponse_httpStatus = (GetIPSetResponse -> Int)
-> (GetIPSetResponse -> Int -> GetIPSetResponse)
-> Lens GetIPSetResponse GetIPSetResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetIPSetResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetIPSetResponse' :: GetIPSetResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetIPSetResponse
s@GetIPSetResponse' {} Int
a -> GetIPSetResponse
s {$sel:httpStatus:GetIPSetResponse' :: Int
httpStatus = Int
a} :: GetIPSetResponse)
getIPSetResponse_name :: Lens.Lens' GetIPSetResponse Prelude.Text
getIPSetResponse_name :: (Text -> f Text) -> GetIPSetResponse -> f GetIPSetResponse
getIPSetResponse_name = (GetIPSetResponse -> Text)
-> (GetIPSetResponse -> Text -> GetIPSetResponse)
-> Lens GetIPSetResponse GetIPSetResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetIPSetResponse' {Text
name :: Text
$sel:name:GetIPSetResponse' :: GetIPSetResponse -> Text
name} -> Text
name) (\s :: GetIPSetResponse
s@GetIPSetResponse' {} Text
a -> GetIPSetResponse
s {$sel:name:GetIPSetResponse' :: Text
name = Text
a} :: GetIPSetResponse)
getIPSetResponse_format :: Lens.Lens' GetIPSetResponse IpSetFormat
getIPSetResponse_format :: (IpSetFormat -> f IpSetFormat)
-> GetIPSetResponse -> f GetIPSetResponse
getIPSetResponse_format = (GetIPSetResponse -> IpSetFormat)
-> (GetIPSetResponse -> IpSetFormat -> GetIPSetResponse)
-> Lens GetIPSetResponse GetIPSetResponse IpSetFormat IpSetFormat
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetIPSetResponse' {IpSetFormat
format :: IpSetFormat
$sel:format:GetIPSetResponse' :: GetIPSetResponse -> IpSetFormat
format} -> IpSetFormat
format) (\s :: GetIPSetResponse
s@GetIPSetResponse' {} IpSetFormat
a -> GetIPSetResponse
s {$sel:format:GetIPSetResponse' :: IpSetFormat
format = IpSetFormat
a} :: GetIPSetResponse)
getIPSetResponse_location :: Lens.Lens' GetIPSetResponse Prelude.Text
getIPSetResponse_location :: (Text -> f Text) -> GetIPSetResponse -> f GetIPSetResponse
getIPSetResponse_location = (GetIPSetResponse -> Text)
-> (GetIPSetResponse -> Text -> GetIPSetResponse)
-> Lens GetIPSetResponse GetIPSetResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetIPSetResponse' {Text
location :: Text
$sel:location:GetIPSetResponse' :: GetIPSetResponse -> Text
location} -> Text
location) (\s :: GetIPSetResponse
s@GetIPSetResponse' {} Text
a -> GetIPSetResponse
s {$sel:location:GetIPSetResponse' :: Text
location = Text
a} :: GetIPSetResponse)
getIPSetResponse_status :: Lens.Lens' GetIPSetResponse IpSetStatus
getIPSetResponse_status :: (IpSetStatus -> f IpSetStatus)
-> GetIPSetResponse -> f GetIPSetResponse
getIPSetResponse_status = (GetIPSetResponse -> IpSetStatus)
-> (GetIPSetResponse -> IpSetStatus -> GetIPSetResponse)
-> Lens GetIPSetResponse GetIPSetResponse IpSetStatus IpSetStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetIPSetResponse' {IpSetStatus
status :: IpSetStatus
$sel:status:GetIPSetResponse' :: GetIPSetResponse -> IpSetStatus
status} -> IpSetStatus
status) (\s :: GetIPSetResponse
s@GetIPSetResponse' {} IpSetStatus
a -> GetIPSetResponse
s {$sel:status:GetIPSetResponse' :: IpSetStatus
status = IpSetStatus
a} :: GetIPSetResponse)
instance Prelude.NFData GetIPSetResponse