{-# 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.MediaConnect.GrantFlowEntitlements
(
GrantFlowEntitlements (..),
newGrantFlowEntitlements,
grantFlowEntitlements_flowArn,
grantFlowEntitlements_entitlements,
GrantFlowEntitlementsResponse (..),
newGrantFlowEntitlementsResponse,
grantFlowEntitlementsResponse_entitlements,
grantFlowEntitlementsResponse_flowArn,
grantFlowEntitlementsResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MediaConnect.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GrantFlowEntitlements = GrantFlowEntitlements'
{
GrantFlowEntitlements -> Text
flowArn :: Prelude.Text,
GrantFlowEntitlements -> [GrantEntitlementRequest]
entitlements :: [GrantEntitlementRequest]
}
deriving (GrantFlowEntitlements -> GrantFlowEntitlements -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GrantFlowEntitlements -> GrantFlowEntitlements -> Bool
$c/= :: GrantFlowEntitlements -> GrantFlowEntitlements -> Bool
== :: GrantFlowEntitlements -> GrantFlowEntitlements -> Bool
$c== :: GrantFlowEntitlements -> GrantFlowEntitlements -> Bool
Prelude.Eq, ReadPrec [GrantFlowEntitlements]
ReadPrec GrantFlowEntitlements
Int -> ReadS GrantFlowEntitlements
ReadS [GrantFlowEntitlements]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GrantFlowEntitlements]
$creadListPrec :: ReadPrec [GrantFlowEntitlements]
readPrec :: ReadPrec GrantFlowEntitlements
$creadPrec :: ReadPrec GrantFlowEntitlements
readList :: ReadS [GrantFlowEntitlements]
$creadList :: ReadS [GrantFlowEntitlements]
readsPrec :: Int -> ReadS GrantFlowEntitlements
$creadsPrec :: Int -> ReadS GrantFlowEntitlements
Prelude.Read, Int -> GrantFlowEntitlements -> ShowS
[GrantFlowEntitlements] -> ShowS
GrantFlowEntitlements -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GrantFlowEntitlements] -> ShowS
$cshowList :: [GrantFlowEntitlements] -> ShowS
show :: GrantFlowEntitlements -> String
$cshow :: GrantFlowEntitlements -> String
showsPrec :: Int -> GrantFlowEntitlements -> ShowS
$cshowsPrec :: Int -> GrantFlowEntitlements -> ShowS
Prelude.Show, forall x. Rep GrantFlowEntitlements x -> GrantFlowEntitlements
forall x. GrantFlowEntitlements -> Rep GrantFlowEntitlements x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GrantFlowEntitlements x -> GrantFlowEntitlements
$cfrom :: forall x. GrantFlowEntitlements -> Rep GrantFlowEntitlements x
Prelude.Generic)
newGrantFlowEntitlements ::
Prelude.Text ->
GrantFlowEntitlements
newGrantFlowEntitlements :: Text -> GrantFlowEntitlements
newGrantFlowEntitlements Text
pFlowArn_ =
GrantFlowEntitlements'
{ $sel:flowArn:GrantFlowEntitlements' :: Text
flowArn = Text
pFlowArn_,
$sel:entitlements:GrantFlowEntitlements' :: [GrantEntitlementRequest]
entitlements = forall a. Monoid a => a
Prelude.mempty
}
grantFlowEntitlements_flowArn :: Lens.Lens' GrantFlowEntitlements Prelude.Text
grantFlowEntitlements_flowArn :: Lens' GrantFlowEntitlements Text
grantFlowEntitlements_flowArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GrantFlowEntitlements' {Text
flowArn :: Text
$sel:flowArn:GrantFlowEntitlements' :: GrantFlowEntitlements -> Text
flowArn} -> Text
flowArn) (\s :: GrantFlowEntitlements
s@GrantFlowEntitlements' {} Text
a -> GrantFlowEntitlements
s {$sel:flowArn:GrantFlowEntitlements' :: Text
flowArn = Text
a} :: GrantFlowEntitlements)
grantFlowEntitlements_entitlements :: Lens.Lens' GrantFlowEntitlements [GrantEntitlementRequest]
grantFlowEntitlements_entitlements :: Lens' GrantFlowEntitlements [GrantEntitlementRequest]
grantFlowEntitlements_entitlements = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GrantFlowEntitlements' {[GrantEntitlementRequest]
entitlements :: [GrantEntitlementRequest]
$sel:entitlements:GrantFlowEntitlements' :: GrantFlowEntitlements -> [GrantEntitlementRequest]
entitlements} -> [GrantEntitlementRequest]
entitlements) (\s :: GrantFlowEntitlements
s@GrantFlowEntitlements' {} [GrantEntitlementRequest]
a -> GrantFlowEntitlements
s {$sel:entitlements:GrantFlowEntitlements' :: [GrantEntitlementRequest]
entitlements = [GrantEntitlementRequest]
a} :: GrantFlowEntitlements) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest GrantFlowEntitlements where
type
AWSResponse GrantFlowEntitlements =
GrantFlowEntitlementsResponse
request :: (Service -> Service)
-> GrantFlowEntitlements -> Request GrantFlowEntitlements
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 GrantFlowEntitlements
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GrantFlowEntitlements)))
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 [Entitlement]
-> Maybe Text -> Int -> GrantFlowEntitlementsResponse
GrantFlowEntitlementsResponse'
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
"entitlements" 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.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"flowArn")
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 GrantFlowEntitlements where
hashWithSalt :: Int -> GrantFlowEntitlements -> Int
hashWithSalt Int
_salt GrantFlowEntitlements' {[GrantEntitlementRequest]
Text
entitlements :: [GrantEntitlementRequest]
flowArn :: Text
$sel:entitlements:GrantFlowEntitlements' :: GrantFlowEntitlements -> [GrantEntitlementRequest]
$sel:flowArn:GrantFlowEntitlements' :: GrantFlowEntitlements -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
flowArn
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [GrantEntitlementRequest]
entitlements
instance Prelude.NFData GrantFlowEntitlements where
rnf :: GrantFlowEntitlements -> ()
rnf GrantFlowEntitlements' {[GrantEntitlementRequest]
Text
entitlements :: [GrantEntitlementRequest]
flowArn :: Text
$sel:entitlements:GrantFlowEntitlements' :: GrantFlowEntitlements -> [GrantEntitlementRequest]
$sel:flowArn:GrantFlowEntitlements' :: GrantFlowEntitlements -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
flowArn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [GrantEntitlementRequest]
entitlements
instance Data.ToHeaders GrantFlowEntitlements where
toHeaders :: GrantFlowEntitlements -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON GrantFlowEntitlements where
toJSON :: GrantFlowEntitlements -> Value
toJSON GrantFlowEntitlements' {[GrantEntitlementRequest]
Text
entitlements :: [GrantEntitlementRequest]
flowArn :: Text
$sel:entitlements:GrantFlowEntitlements' :: GrantFlowEntitlements -> [GrantEntitlementRequest]
$sel:flowArn:GrantFlowEntitlements' :: GrantFlowEntitlements -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[forall a. a -> Maybe a
Prelude.Just (Key
"entitlements" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [GrantEntitlementRequest]
entitlements)]
)
instance Data.ToPath GrantFlowEntitlements where
toPath :: GrantFlowEntitlements -> ByteString
toPath GrantFlowEntitlements' {[GrantEntitlementRequest]
Text
entitlements :: [GrantEntitlementRequest]
flowArn :: Text
$sel:entitlements:GrantFlowEntitlements' :: GrantFlowEntitlements -> [GrantEntitlementRequest]
$sel:flowArn:GrantFlowEntitlements' :: GrantFlowEntitlements -> Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/v1/flows/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
flowArn, ByteString
"/entitlements"]
instance Data.ToQuery GrantFlowEntitlements where
toQuery :: GrantFlowEntitlements -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data GrantFlowEntitlementsResponse = GrantFlowEntitlementsResponse'
{
GrantFlowEntitlementsResponse -> Maybe [Entitlement]
entitlements :: Prelude.Maybe [Entitlement],
GrantFlowEntitlementsResponse -> Maybe Text
flowArn :: Prelude.Maybe Prelude.Text,
GrantFlowEntitlementsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GrantFlowEntitlementsResponse
-> GrantFlowEntitlementsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GrantFlowEntitlementsResponse
-> GrantFlowEntitlementsResponse -> Bool
$c/= :: GrantFlowEntitlementsResponse
-> GrantFlowEntitlementsResponse -> Bool
== :: GrantFlowEntitlementsResponse
-> GrantFlowEntitlementsResponse -> Bool
$c== :: GrantFlowEntitlementsResponse
-> GrantFlowEntitlementsResponse -> Bool
Prelude.Eq, ReadPrec [GrantFlowEntitlementsResponse]
ReadPrec GrantFlowEntitlementsResponse
Int -> ReadS GrantFlowEntitlementsResponse
ReadS [GrantFlowEntitlementsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GrantFlowEntitlementsResponse]
$creadListPrec :: ReadPrec [GrantFlowEntitlementsResponse]
readPrec :: ReadPrec GrantFlowEntitlementsResponse
$creadPrec :: ReadPrec GrantFlowEntitlementsResponse
readList :: ReadS [GrantFlowEntitlementsResponse]
$creadList :: ReadS [GrantFlowEntitlementsResponse]
readsPrec :: Int -> ReadS GrantFlowEntitlementsResponse
$creadsPrec :: Int -> ReadS GrantFlowEntitlementsResponse
Prelude.Read, Int -> GrantFlowEntitlementsResponse -> ShowS
[GrantFlowEntitlementsResponse] -> ShowS
GrantFlowEntitlementsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GrantFlowEntitlementsResponse] -> ShowS
$cshowList :: [GrantFlowEntitlementsResponse] -> ShowS
show :: GrantFlowEntitlementsResponse -> String
$cshow :: GrantFlowEntitlementsResponse -> String
showsPrec :: Int -> GrantFlowEntitlementsResponse -> ShowS
$cshowsPrec :: Int -> GrantFlowEntitlementsResponse -> ShowS
Prelude.Show, forall x.
Rep GrantFlowEntitlementsResponse x
-> GrantFlowEntitlementsResponse
forall x.
GrantFlowEntitlementsResponse
-> Rep GrantFlowEntitlementsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GrantFlowEntitlementsResponse x
-> GrantFlowEntitlementsResponse
$cfrom :: forall x.
GrantFlowEntitlementsResponse
-> Rep GrantFlowEntitlementsResponse x
Prelude.Generic)
newGrantFlowEntitlementsResponse ::
Prelude.Int ->
GrantFlowEntitlementsResponse
newGrantFlowEntitlementsResponse :: Int -> GrantFlowEntitlementsResponse
newGrantFlowEntitlementsResponse Int
pHttpStatus_ =
GrantFlowEntitlementsResponse'
{ $sel:entitlements:GrantFlowEntitlementsResponse' :: Maybe [Entitlement]
entitlements =
forall a. Maybe a
Prelude.Nothing,
$sel:flowArn:GrantFlowEntitlementsResponse' :: Maybe Text
flowArn = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GrantFlowEntitlementsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
grantFlowEntitlementsResponse_entitlements :: Lens.Lens' GrantFlowEntitlementsResponse (Prelude.Maybe [Entitlement])
grantFlowEntitlementsResponse_entitlements :: Lens' GrantFlowEntitlementsResponse (Maybe [Entitlement])
grantFlowEntitlementsResponse_entitlements = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GrantFlowEntitlementsResponse' {Maybe [Entitlement]
entitlements :: Maybe [Entitlement]
$sel:entitlements:GrantFlowEntitlementsResponse' :: GrantFlowEntitlementsResponse -> Maybe [Entitlement]
entitlements} -> Maybe [Entitlement]
entitlements) (\s :: GrantFlowEntitlementsResponse
s@GrantFlowEntitlementsResponse' {} Maybe [Entitlement]
a -> GrantFlowEntitlementsResponse
s {$sel:entitlements:GrantFlowEntitlementsResponse' :: Maybe [Entitlement]
entitlements = Maybe [Entitlement]
a} :: GrantFlowEntitlementsResponse) 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
grantFlowEntitlementsResponse_flowArn :: Lens.Lens' GrantFlowEntitlementsResponse (Prelude.Maybe Prelude.Text)
grantFlowEntitlementsResponse_flowArn :: Lens' GrantFlowEntitlementsResponse (Maybe Text)
grantFlowEntitlementsResponse_flowArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GrantFlowEntitlementsResponse' {Maybe Text
flowArn :: Maybe Text
$sel:flowArn:GrantFlowEntitlementsResponse' :: GrantFlowEntitlementsResponse -> Maybe Text
flowArn} -> Maybe Text
flowArn) (\s :: GrantFlowEntitlementsResponse
s@GrantFlowEntitlementsResponse' {} Maybe Text
a -> GrantFlowEntitlementsResponse
s {$sel:flowArn:GrantFlowEntitlementsResponse' :: Maybe Text
flowArn = Maybe Text
a} :: GrantFlowEntitlementsResponse)
grantFlowEntitlementsResponse_httpStatus :: Lens.Lens' GrantFlowEntitlementsResponse Prelude.Int
grantFlowEntitlementsResponse_httpStatus :: Lens' GrantFlowEntitlementsResponse Int
grantFlowEntitlementsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GrantFlowEntitlementsResponse' {Int
httpStatus :: Int
$sel:httpStatus:GrantFlowEntitlementsResponse' :: GrantFlowEntitlementsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GrantFlowEntitlementsResponse
s@GrantFlowEntitlementsResponse' {} Int
a -> GrantFlowEntitlementsResponse
s {$sel:httpStatus:GrantFlowEntitlementsResponse' :: Int
httpStatus = Int
a} :: GrantFlowEntitlementsResponse)
instance Prelude.NFData GrantFlowEntitlementsResponse where
rnf :: GrantFlowEntitlementsResponse -> ()
rnf GrantFlowEntitlementsResponse' {Int
Maybe [Entitlement]
Maybe Text
httpStatus :: Int
flowArn :: Maybe Text
entitlements :: Maybe [Entitlement]
$sel:httpStatus:GrantFlowEntitlementsResponse' :: GrantFlowEntitlementsResponse -> Int
$sel:flowArn:GrantFlowEntitlementsResponse' :: GrantFlowEntitlementsResponse -> Maybe Text
$sel:entitlements:GrantFlowEntitlementsResponse' :: GrantFlowEntitlementsResponse -> Maybe [Entitlement]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [Entitlement]
entitlements
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
flowArn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus