{-# 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.IoT.GetEffectivePolicies
(
GetEffectivePolicies (..),
newGetEffectivePolicies,
getEffectivePolicies_principal,
getEffectivePolicies_cognitoIdentityPoolId,
getEffectivePolicies_thingName,
GetEffectivePoliciesResponse (..),
newGetEffectivePoliciesResponse,
getEffectivePoliciesResponse_effectivePolicies,
getEffectivePoliciesResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.IoT.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 GetEffectivePolicies = GetEffectivePolicies'
{
GetEffectivePolicies -> Maybe Text
principal :: Prelude.Maybe Prelude.Text,
GetEffectivePolicies -> Maybe Text
cognitoIdentityPoolId :: Prelude.Maybe Prelude.Text,
GetEffectivePolicies -> Maybe Text
thingName :: Prelude.Maybe Prelude.Text
}
deriving (GetEffectivePolicies -> GetEffectivePolicies -> Bool
(GetEffectivePolicies -> GetEffectivePolicies -> Bool)
-> (GetEffectivePolicies -> GetEffectivePolicies -> Bool)
-> Eq GetEffectivePolicies
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetEffectivePolicies -> GetEffectivePolicies -> Bool
$c/= :: GetEffectivePolicies -> GetEffectivePolicies -> Bool
== :: GetEffectivePolicies -> GetEffectivePolicies -> Bool
$c== :: GetEffectivePolicies -> GetEffectivePolicies -> Bool
Prelude.Eq, ReadPrec [GetEffectivePolicies]
ReadPrec GetEffectivePolicies
Int -> ReadS GetEffectivePolicies
ReadS [GetEffectivePolicies]
(Int -> ReadS GetEffectivePolicies)
-> ReadS [GetEffectivePolicies]
-> ReadPrec GetEffectivePolicies
-> ReadPrec [GetEffectivePolicies]
-> Read GetEffectivePolicies
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetEffectivePolicies]
$creadListPrec :: ReadPrec [GetEffectivePolicies]
readPrec :: ReadPrec GetEffectivePolicies
$creadPrec :: ReadPrec GetEffectivePolicies
readList :: ReadS [GetEffectivePolicies]
$creadList :: ReadS [GetEffectivePolicies]
readsPrec :: Int -> ReadS GetEffectivePolicies
$creadsPrec :: Int -> ReadS GetEffectivePolicies
Prelude.Read, Int -> GetEffectivePolicies -> ShowS
[GetEffectivePolicies] -> ShowS
GetEffectivePolicies -> String
(Int -> GetEffectivePolicies -> ShowS)
-> (GetEffectivePolicies -> String)
-> ([GetEffectivePolicies] -> ShowS)
-> Show GetEffectivePolicies
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetEffectivePolicies] -> ShowS
$cshowList :: [GetEffectivePolicies] -> ShowS
show :: GetEffectivePolicies -> String
$cshow :: GetEffectivePolicies -> String
showsPrec :: Int -> GetEffectivePolicies -> ShowS
$cshowsPrec :: Int -> GetEffectivePolicies -> ShowS
Prelude.Show, (forall x. GetEffectivePolicies -> Rep GetEffectivePolicies x)
-> (forall x. Rep GetEffectivePolicies x -> GetEffectivePolicies)
-> Generic GetEffectivePolicies
forall x. Rep GetEffectivePolicies x -> GetEffectivePolicies
forall x. GetEffectivePolicies -> Rep GetEffectivePolicies x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetEffectivePolicies x -> GetEffectivePolicies
$cfrom :: forall x. GetEffectivePolicies -> Rep GetEffectivePolicies x
Prelude.Generic)
newGetEffectivePolicies ::
GetEffectivePolicies
newGetEffectivePolicies :: GetEffectivePolicies
newGetEffectivePolicies =
GetEffectivePolicies' :: Maybe Text -> Maybe Text -> Maybe Text -> GetEffectivePolicies
GetEffectivePolicies'
{ $sel:principal:GetEffectivePolicies' :: Maybe Text
principal = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:cognitoIdentityPoolId:GetEffectivePolicies' :: Maybe Text
cognitoIdentityPoolId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:thingName:GetEffectivePolicies' :: Maybe Text
thingName = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
getEffectivePolicies_principal :: Lens.Lens' GetEffectivePolicies (Prelude.Maybe Prelude.Text)
getEffectivePolicies_principal :: (Maybe Text -> f (Maybe Text))
-> GetEffectivePolicies -> f GetEffectivePolicies
getEffectivePolicies_principal = (GetEffectivePolicies -> Maybe Text)
-> (GetEffectivePolicies -> Maybe Text -> GetEffectivePolicies)
-> Lens
GetEffectivePolicies GetEffectivePolicies (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetEffectivePolicies' {Maybe Text
principal :: Maybe Text
$sel:principal:GetEffectivePolicies' :: GetEffectivePolicies -> Maybe Text
principal} -> Maybe Text
principal) (\s :: GetEffectivePolicies
s@GetEffectivePolicies' {} Maybe Text
a -> GetEffectivePolicies
s {$sel:principal:GetEffectivePolicies' :: Maybe Text
principal = Maybe Text
a} :: GetEffectivePolicies)
getEffectivePolicies_cognitoIdentityPoolId :: Lens.Lens' GetEffectivePolicies (Prelude.Maybe Prelude.Text)
getEffectivePolicies_cognitoIdentityPoolId :: (Maybe Text -> f (Maybe Text))
-> GetEffectivePolicies -> f GetEffectivePolicies
getEffectivePolicies_cognitoIdentityPoolId = (GetEffectivePolicies -> Maybe Text)
-> (GetEffectivePolicies -> Maybe Text -> GetEffectivePolicies)
-> Lens
GetEffectivePolicies GetEffectivePolicies (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetEffectivePolicies' {Maybe Text
cognitoIdentityPoolId :: Maybe Text
$sel:cognitoIdentityPoolId:GetEffectivePolicies' :: GetEffectivePolicies -> Maybe Text
cognitoIdentityPoolId} -> Maybe Text
cognitoIdentityPoolId) (\s :: GetEffectivePolicies
s@GetEffectivePolicies' {} Maybe Text
a -> GetEffectivePolicies
s {$sel:cognitoIdentityPoolId:GetEffectivePolicies' :: Maybe Text
cognitoIdentityPoolId = Maybe Text
a} :: GetEffectivePolicies)
getEffectivePolicies_thingName :: Lens.Lens' GetEffectivePolicies (Prelude.Maybe Prelude.Text)
getEffectivePolicies_thingName :: (Maybe Text -> f (Maybe Text))
-> GetEffectivePolicies -> f GetEffectivePolicies
getEffectivePolicies_thingName = (GetEffectivePolicies -> Maybe Text)
-> (GetEffectivePolicies -> Maybe Text -> GetEffectivePolicies)
-> Lens
GetEffectivePolicies GetEffectivePolicies (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetEffectivePolicies' {Maybe Text
thingName :: Maybe Text
$sel:thingName:GetEffectivePolicies' :: GetEffectivePolicies -> Maybe Text
thingName} -> Maybe Text
thingName) (\s :: GetEffectivePolicies
s@GetEffectivePolicies' {} Maybe Text
a -> GetEffectivePolicies
s {$sel:thingName:GetEffectivePolicies' :: Maybe Text
thingName = Maybe Text
a} :: GetEffectivePolicies)
instance Core.AWSRequest GetEffectivePolicies where
type
AWSResponse GetEffectivePolicies =
GetEffectivePoliciesResponse
request :: GetEffectivePolicies -> Request GetEffectivePolicies
request = Service -> GetEffectivePolicies -> Request GetEffectivePolicies
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetEffectivePolicies
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetEffectivePolicies)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetEffectivePolicies))
-> Logger
-> Service
-> Proxy GetEffectivePolicies
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetEffectivePolicies)))
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 [EffectivePolicy] -> Int -> GetEffectivePoliciesResponse
GetEffectivePoliciesResponse'
(Maybe [EffectivePolicy] -> Int -> GetEffectivePoliciesResponse)
-> Either String (Maybe [EffectivePolicy])
-> Either String (Int -> GetEffectivePoliciesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Either String (Maybe (Maybe [EffectivePolicy]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"effectivePolicies"
Either String (Maybe (Maybe [EffectivePolicy]))
-> Maybe [EffectivePolicy]
-> Either String (Maybe [EffectivePolicy])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [EffectivePolicy]
forall a. Monoid a => a
Prelude.mempty
)
Either String (Int -> GetEffectivePoliciesResponse)
-> Either String Int -> Either String GetEffectivePoliciesResponse
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 GetEffectivePolicies
instance Prelude.NFData GetEffectivePolicies
instance Core.ToHeaders GetEffectivePolicies where
toHeaders :: GetEffectivePolicies -> ResponseHeaders
toHeaders = ResponseHeaders -> GetEffectivePolicies -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToJSON GetEffectivePolicies where
toJSON :: GetEffectivePolicies -> Value
toJSON GetEffectivePolicies' {Maybe Text
thingName :: Maybe Text
cognitoIdentityPoolId :: Maybe Text
principal :: Maybe Text
$sel:thingName:GetEffectivePolicies' :: GetEffectivePolicies -> Maybe Text
$sel:cognitoIdentityPoolId:GetEffectivePolicies' :: GetEffectivePolicies -> Maybe Text
$sel:principal:GetEffectivePolicies' :: GetEffectivePolicies -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"principal" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
principal,
(Text
"cognitoIdentityPoolId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
cognitoIdentityPoolId
]
)
instance Core.ToPath GetEffectivePolicies where
toPath :: GetEffectivePolicies -> ByteString
toPath = ByteString -> GetEffectivePolicies -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/effective-policies"
instance Core.ToQuery GetEffectivePolicies where
toQuery :: GetEffectivePolicies -> QueryString
toQuery GetEffectivePolicies' {Maybe Text
thingName :: Maybe Text
cognitoIdentityPoolId :: Maybe Text
principal :: Maybe Text
$sel:thingName:GetEffectivePolicies' :: GetEffectivePolicies -> Maybe Text
$sel:cognitoIdentityPoolId:GetEffectivePolicies' :: GetEffectivePolicies -> Maybe Text
$sel:principal:GetEffectivePolicies' :: GetEffectivePolicies -> Maybe Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"thingName" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
thingName]
data GetEffectivePoliciesResponse = GetEffectivePoliciesResponse'
{
GetEffectivePoliciesResponse -> Maybe [EffectivePolicy]
effectivePolicies :: Prelude.Maybe [EffectivePolicy],
GetEffectivePoliciesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetEffectivePoliciesResponse
-> GetEffectivePoliciesResponse -> Bool
(GetEffectivePoliciesResponse
-> GetEffectivePoliciesResponse -> Bool)
-> (GetEffectivePoliciesResponse
-> GetEffectivePoliciesResponse -> Bool)
-> Eq GetEffectivePoliciesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetEffectivePoliciesResponse
-> GetEffectivePoliciesResponse -> Bool
$c/= :: GetEffectivePoliciesResponse
-> GetEffectivePoliciesResponse -> Bool
== :: GetEffectivePoliciesResponse
-> GetEffectivePoliciesResponse -> Bool
$c== :: GetEffectivePoliciesResponse
-> GetEffectivePoliciesResponse -> Bool
Prelude.Eq, ReadPrec [GetEffectivePoliciesResponse]
ReadPrec GetEffectivePoliciesResponse
Int -> ReadS GetEffectivePoliciesResponse
ReadS [GetEffectivePoliciesResponse]
(Int -> ReadS GetEffectivePoliciesResponse)
-> ReadS [GetEffectivePoliciesResponse]
-> ReadPrec GetEffectivePoliciesResponse
-> ReadPrec [GetEffectivePoliciesResponse]
-> Read GetEffectivePoliciesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetEffectivePoliciesResponse]
$creadListPrec :: ReadPrec [GetEffectivePoliciesResponse]
readPrec :: ReadPrec GetEffectivePoliciesResponse
$creadPrec :: ReadPrec GetEffectivePoliciesResponse
readList :: ReadS [GetEffectivePoliciesResponse]
$creadList :: ReadS [GetEffectivePoliciesResponse]
readsPrec :: Int -> ReadS GetEffectivePoliciesResponse
$creadsPrec :: Int -> ReadS GetEffectivePoliciesResponse
Prelude.Read, Int -> GetEffectivePoliciesResponse -> ShowS
[GetEffectivePoliciesResponse] -> ShowS
GetEffectivePoliciesResponse -> String
(Int -> GetEffectivePoliciesResponse -> ShowS)
-> (GetEffectivePoliciesResponse -> String)
-> ([GetEffectivePoliciesResponse] -> ShowS)
-> Show GetEffectivePoliciesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetEffectivePoliciesResponse] -> ShowS
$cshowList :: [GetEffectivePoliciesResponse] -> ShowS
show :: GetEffectivePoliciesResponse -> String
$cshow :: GetEffectivePoliciesResponse -> String
showsPrec :: Int -> GetEffectivePoliciesResponse -> ShowS
$cshowsPrec :: Int -> GetEffectivePoliciesResponse -> ShowS
Prelude.Show, (forall x.
GetEffectivePoliciesResponse -> Rep GetEffectivePoliciesResponse x)
-> (forall x.
Rep GetEffectivePoliciesResponse x -> GetEffectivePoliciesResponse)
-> Generic GetEffectivePoliciesResponse
forall x.
Rep GetEffectivePoliciesResponse x -> GetEffectivePoliciesResponse
forall x.
GetEffectivePoliciesResponse -> Rep GetEffectivePoliciesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetEffectivePoliciesResponse x -> GetEffectivePoliciesResponse
$cfrom :: forall x.
GetEffectivePoliciesResponse -> Rep GetEffectivePoliciesResponse x
Prelude.Generic)
newGetEffectivePoliciesResponse ::
Prelude.Int ->
GetEffectivePoliciesResponse
newGetEffectivePoliciesResponse :: Int -> GetEffectivePoliciesResponse
newGetEffectivePoliciesResponse Int
pHttpStatus_ =
GetEffectivePoliciesResponse' :: Maybe [EffectivePolicy] -> Int -> GetEffectivePoliciesResponse
GetEffectivePoliciesResponse'
{ $sel:effectivePolicies:GetEffectivePoliciesResponse' :: Maybe [EffectivePolicy]
effectivePolicies =
Maybe [EffectivePolicy]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetEffectivePoliciesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getEffectivePoliciesResponse_effectivePolicies :: Lens.Lens' GetEffectivePoliciesResponse (Prelude.Maybe [EffectivePolicy])
getEffectivePoliciesResponse_effectivePolicies :: (Maybe [EffectivePolicy] -> f (Maybe [EffectivePolicy]))
-> GetEffectivePoliciesResponse -> f GetEffectivePoliciesResponse
getEffectivePoliciesResponse_effectivePolicies = (GetEffectivePoliciesResponse -> Maybe [EffectivePolicy])
-> (GetEffectivePoliciesResponse
-> Maybe [EffectivePolicy] -> GetEffectivePoliciesResponse)
-> Lens
GetEffectivePoliciesResponse
GetEffectivePoliciesResponse
(Maybe [EffectivePolicy])
(Maybe [EffectivePolicy])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetEffectivePoliciesResponse' {Maybe [EffectivePolicy]
effectivePolicies :: Maybe [EffectivePolicy]
$sel:effectivePolicies:GetEffectivePoliciesResponse' :: GetEffectivePoliciesResponse -> Maybe [EffectivePolicy]
effectivePolicies} -> Maybe [EffectivePolicy]
effectivePolicies) (\s :: GetEffectivePoliciesResponse
s@GetEffectivePoliciesResponse' {} Maybe [EffectivePolicy]
a -> GetEffectivePoliciesResponse
s {$sel:effectivePolicies:GetEffectivePoliciesResponse' :: Maybe [EffectivePolicy]
effectivePolicies = Maybe [EffectivePolicy]
a} :: GetEffectivePoliciesResponse) ((Maybe [EffectivePolicy] -> f (Maybe [EffectivePolicy]))
-> GetEffectivePoliciesResponse -> f GetEffectivePoliciesResponse)
-> ((Maybe [EffectivePolicy] -> f (Maybe [EffectivePolicy]))
-> Maybe [EffectivePolicy] -> f (Maybe [EffectivePolicy]))
-> (Maybe [EffectivePolicy] -> f (Maybe [EffectivePolicy]))
-> GetEffectivePoliciesResponse
-> f GetEffectivePoliciesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[EffectivePolicy]
[EffectivePolicy]
[EffectivePolicy]
[EffectivePolicy]
-> Iso
(Maybe [EffectivePolicy])
(Maybe [EffectivePolicy])
(Maybe [EffectivePolicy])
(Maybe [EffectivePolicy])
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
[EffectivePolicy]
[EffectivePolicy]
[EffectivePolicy]
[EffectivePolicy]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getEffectivePoliciesResponse_httpStatus :: Lens.Lens' GetEffectivePoliciesResponse Prelude.Int
getEffectivePoliciesResponse_httpStatus :: (Int -> f Int)
-> GetEffectivePoliciesResponse -> f GetEffectivePoliciesResponse
getEffectivePoliciesResponse_httpStatus = (GetEffectivePoliciesResponse -> Int)
-> (GetEffectivePoliciesResponse
-> Int -> GetEffectivePoliciesResponse)
-> Lens
GetEffectivePoliciesResponse GetEffectivePoliciesResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetEffectivePoliciesResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetEffectivePoliciesResponse' :: GetEffectivePoliciesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetEffectivePoliciesResponse
s@GetEffectivePoliciesResponse' {} Int
a -> GetEffectivePoliciesResponse
s {$sel:httpStatus:GetEffectivePoliciesResponse' :: Int
httpStatus = Int
a} :: GetEffectivePoliciesResponse)
instance Prelude.NFData GetEffectivePoliciesResponse