{-# 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_cognitoIdentityPoolId,
getEffectivePolicies_principal,
getEffectivePolicies_thingName,
GetEffectivePoliciesResponse (..),
newGetEffectivePoliciesResponse,
getEffectivePoliciesResponse_effectivePolicies,
getEffectivePoliciesResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IoT.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetEffectivePolicies = GetEffectivePolicies'
{
GetEffectivePolicies -> Maybe Text
cognitoIdentityPoolId :: Prelude.Maybe Prelude.Text,
GetEffectivePolicies -> Maybe Text
principal :: Prelude.Maybe Prelude.Text,
GetEffectivePolicies -> Maybe Text
thingName :: Prelude.Maybe Prelude.Text
}
deriving (GetEffectivePolicies -> GetEffectivePolicies -> Bool
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]
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
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. 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'
{ $sel:cognitoIdentityPoolId:GetEffectivePolicies' :: Maybe Text
cognitoIdentityPoolId =
forall a. Maybe a
Prelude.Nothing,
$sel:principal:GetEffectivePolicies' :: Maybe Text
principal = forall a. Maybe a
Prelude.Nothing,
$sel:thingName:GetEffectivePolicies' :: Maybe Text
thingName = forall a. Maybe a
Prelude.Nothing
}
getEffectivePolicies_cognitoIdentityPoolId :: Lens.Lens' GetEffectivePolicies (Prelude.Maybe Prelude.Text)
getEffectivePolicies_cognitoIdentityPoolId :: Lens' GetEffectivePolicies (Maybe Text)
getEffectivePolicies_cognitoIdentityPoolId = 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_principal :: Lens.Lens' GetEffectivePolicies (Prelude.Maybe Prelude.Text)
getEffectivePolicies_principal :: Lens' GetEffectivePolicies (Maybe Text)
getEffectivePolicies_principal = 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_thingName :: Lens.Lens' GetEffectivePolicies (Prelude.Maybe Prelude.Text)
getEffectivePolicies_thingName :: Lens' GetEffectivePolicies (Maybe Text)
getEffectivePolicies_thingName = 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 :: (Service -> Service)
-> GetEffectivePolicies -> Request GetEffectivePolicies
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetEffectivePolicies
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetEffectivePolicies)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe [EffectivePolicy] -> Int -> GetEffectivePoliciesResponse
GetEffectivePoliciesResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x
forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"effectivePolicies"
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable GetEffectivePolicies where
hashWithSalt :: Int -> GetEffectivePolicies -> Int
hashWithSalt Int
_salt GetEffectivePolicies' {Maybe Text
thingName :: Maybe Text
principal :: Maybe Text
cognitoIdentityPoolId :: Maybe Text
$sel:thingName:GetEffectivePolicies' :: GetEffectivePolicies -> Maybe Text
$sel:principal:GetEffectivePolicies' :: GetEffectivePolicies -> Maybe Text
$sel:cognitoIdentityPoolId:GetEffectivePolicies' :: GetEffectivePolicies -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
cognitoIdentityPoolId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
principal
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
thingName
instance Prelude.NFData GetEffectivePolicies where
rnf :: GetEffectivePolicies -> ()
rnf GetEffectivePolicies' {Maybe Text
thingName :: Maybe Text
principal :: Maybe Text
cognitoIdentityPoolId :: Maybe Text
$sel:thingName:GetEffectivePolicies' :: GetEffectivePolicies -> Maybe Text
$sel:principal:GetEffectivePolicies' :: GetEffectivePolicies -> Maybe Text
$sel:cognitoIdentityPoolId:GetEffectivePolicies' :: GetEffectivePolicies -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
cognitoIdentityPoolId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
principal
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
thingName
instance Data.ToHeaders GetEffectivePolicies where
toHeaders :: GetEffectivePolicies -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.ToJSON GetEffectivePolicies where
toJSON :: GetEffectivePolicies -> Value
toJSON GetEffectivePolicies' {Maybe Text
thingName :: Maybe Text
principal :: Maybe Text
cognitoIdentityPoolId :: Maybe Text
$sel:thingName:GetEffectivePolicies' :: GetEffectivePolicies -> Maybe Text
$sel:principal:GetEffectivePolicies' :: GetEffectivePolicies -> Maybe Text
$sel:cognitoIdentityPoolId:GetEffectivePolicies' :: GetEffectivePolicies -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"cognitoIdentityPoolId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
cognitoIdentityPoolId,
(Key
"principal" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
principal
]
)
instance Data.ToPath GetEffectivePolicies where
toPath :: GetEffectivePolicies -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/effective-policies"
instance Data.ToQuery GetEffectivePolicies where
toQuery :: GetEffectivePolicies -> QueryString
toQuery GetEffectivePolicies' {Maybe Text
thingName :: Maybe Text
principal :: Maybe Text
cognitoIdentityPoolId :: Maybe Text
$sel:thingName:GetEffectivePolicies' :: GetEffectivePolicies -> Maybe Text
$sel:principal:GetEffectivePolicies' :: GetEffectivePolicies -> Maybe Text
$sel:cognitoIdentityPoolId:GetEffectivePolicies' :: GetEffectivePolicies -> Maybe Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"thingName" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
thingName]
data GetEffectivePoliciesResponse = GetEffectivePoliciesResponse'
{
GetEffectivePoliciesResponse -> Maybe [EffectivePolicy]
effectivePolicies :: Prelude.Maybe [EffectivePolicy],
GetEffectivePoliciesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetEffectivePoliciesResponse
-> GetEffectivePoliciesResponse -> Bool
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]
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
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.
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'
{ $sel:effectivePolicies:GetEffectivePoliciesResponse' :: Maybe [EffectivePolicy]
effectivePolicies =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetEffectivePoliciesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getEffectivePoliciesResponse_effectivePolicies :: Lens.Lens' GetEffectivePoliciesResponse (Prelude.Maybe [EffectivePolicy])
getEffectivePoliciesResponse_effectivePolicies :: Lens' GetEffectivePoliciesResponse (Maybe [EffectivePolicy])
getEffectivePoliciesResponse_effectivePolicies = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 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 :: Lens' GetEffectivePoliciesResponse Int
getEffectivePoliciesResponse_httpStatus = 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 where
rnf :: GetEffectivePoliciesResponse -> ()
rnf GetEffectivePoliciesResponse' {Int
Maybe [EffectivePolicy]
httpStatus :: Int
effectivePolicies :: Maybe [EffectivePolicy]
$sel:httpStatus:GetEffectivePoliciesResponse' :: GetEffectivePoliciesResponse -> Int
$sel:effectivePolicies:GetEffectivePoliciesResponse' :: GetEffectivePoliciesResponse -> Maybe [EffectivePolicy]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [EffectivePolicy]
effectivePolicies
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus