{-# 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.MediaTailor.GetChannelPolicy
(
GetChannelPolicy (..),
newGetChannelPolicy,
getChannelPolicy_channelName,
GetChannelPolicyResponse (..),
newGetChannelPolicyResponse,
getChannelPolicyResponse_policy,
getChannelPolicyResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaTailor.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetChannelPolicy = GetChannelPolicy'
{
GetChannelPolicy -> Text
channelName :: Prelude.Text
}
deriving (GetChannelPolicy -> GetChannelPolicy -> Bool
(GetChannelPolicy -> GetChannelPolicy -> Bool)
-> (GetChannelPolicy -> GetChannelPolicy -> Bool)
-> Eq GetChannelPolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetChannelPolicy -> GetChannelPolicy -> Bool
$c/= :: GetChannelPolicy -> GetChannelPolicy -> Bool
== :: GetChannelPolicy -> GetChannelPolicy -> Bool
$c== :: GetChannelPolicy -> GetChannelPolicy -> Bool
Prelude.Eq, ReadPrec [GetChannelPolicy]
ReadPrec GetChannelPolicy
Int -> ReadS GetChannelPolicy
ReadS [GetChannelPolicy]
(Int -> ReadS GetChannelPolicy)
-> ReadS [GetChannelPolicy]
-> ReadPrec GetChannelPolicy
-> ReadPrec [GetChannelPolicy]
-> Read GetChannelPolicy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetChannelPolicy]
$creadListPrec :: ReadPrec [GetChannelPolicy]
readPrec :: ReadPrec GetChannelPolicy
$creadPrec :: ReadPrec GetChannelPolicy
readList :: ReadS [GetChannelPolicy]
$creadList :: ReadS [GetChannelPolicy]
readsPrec :: Int -> ReadS GetChannelPolicy
$creadsPrec :: Int -> ReadS GetChannelPolicy
Prelude.Read, Int -> GetChannelPolicy -> ShowS
[GetChannelPolicy] -> ShowS
GetChannelPolicy -> String
(Int -> GetChannelPolicy -> ShowS)
-> (GetChannelPolicy -> String)
-> ([GetChannelPolicy] -> ShowS)
-> Show GetChannelPolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetChannelPolicy] -> ShowS
$cshowList :: [GetChannelPolicy] -> ShowS
show :: GetChannelPolicy -> String
$cshow :: GetChannelPolicy -> String
showsPrec :: Int -> GetChannelPolicy -> ShowS
$cshowsPrec :: Int -> GetChannelPolicy -> ShowS
Prelude.Show, (forall x. GetChannelPolicy -> Rep GetChannelPolicy x)
-> (forall x. Rep GetChannelPolicy x -> GetChannelPolicy)
-> Generic GetChannelPolicy
forall x. Rep GetChannelPolicy x -> GetChannelPolicy
forall x. GetChannelPolicy -> Rep GetChannelPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetChannelPolicy x -> GetChannelPolicy
$cfrom :: forall x. GetChannelPolicy -> Rep GetChannelPolicy x
Prelude.Generic)
newGetChannelPolicy ::
Prelude.Text ->
GetChannelPolicy
newGetChannelPolicy :: Text -> GetChannelPolicy
newGetChannelPolicy Text
pChannelName_ =
GetChannelPolicy' :: Text -> GetChannelPolicy
GetChannelPolicy' {$sel:channelName:GetChannelPolicy' :: Text
channelName = Text
pChannelName_}
getChannelPolicy_channelName :: Lens.Lens' GetChannelPolicy Prelude.Text
getChannelPolicy_channelName :: (Text -> f Text) -> GetChannelPolicy -> f GetChannelPolicy
getChannelPolicy_channelName = (GetChannelPolicy -> Text)
-> (GetChannelPolicy -> Text -> GetChannelPolicy)
-> Lens GetChannelPolicy GetChannelPolicy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetChannelPolicy' {Text
channelName :: Text
$sel:channelName:GetChannelPolicy' :: GetChannelPolicy -> Text
channelName} -> Text
channelName) (\s :: GetChannelPolicy
s@GetChannelPolicy' {} Text
a -> GetChannelPolicy
s {$sel:channelName:GetChannelPolicy' :: Text
channelName = Text
a} :: GetChannelPolicy)
instance Core.AWSRequest GetChannelPolicy where
type
AWSResponse GetChannelPolicy =
GetChannelPolicyResponse
request :: GetChannelPolicy -> Request GetChannelPolicy
request = Service -> GetChannelPolicy -> Request GetChannelPolicy
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetChannelPolicy
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetChannelPolicy)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetChannelPolicy))
-> Logger
-> Service
-> Proxy GetChannelPolicy
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetChannelPolicy)))
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 Text -> Int -> GetChannelPolicyResponse
GetChannelPolicyResponse'
(Maybe Text -> Int -> GetChannelPolicyResponse)
-> Either String (Maybe Text)
-> Either String (Int -> GetChannelPolicyResponse)
forall (f :: * -> *) a b. Functor 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
"Policy")
Either String (Int -> GetChannelPolicyResponse)
-> Either String Int -> Either String GetChannelPolicyResponse
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 GetChannelPolicy
instance Prelude.NFData GetChannelPolicy
instance Core.ToHeaders GetChannelPolicy where
toHeaders :: GetChannelPolicy -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetChannelPolicy -> 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 GetChannelPolicy where
toPath :: GetChannelPolicy -> ByteString
toPath GetChannelPolicy' {Text
channelName :: Text
$sel:channelName:GetChannelPolicy' :: GetChannelPolicy -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/channel/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
channelName, ByteString
"/policy"]
instance Core.ToQuery GetChannelPolicy where
toQuery :: GetChannelPolicy -> QueryString
toQuery = QueryString -> GetChannelPolicy -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetChannelPolicyResponse = GetChannelPolicyResponse'
{
GetChannelPolicyResponse -> Maybe Text
policy :: Prelude.Maybe Prelude.Text,
GetChannelPolicyResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetChannelPolicyResponse -> GetChannelPolicyResponse -> Bool
(GetChannelPolicyResponse -> GetChannelPolicyResponse -> Bool)
-> (GetChannelPolicyResponse -> GetChannelPolicyResponse -> Bool)
-> Eq GetChannelPolicyResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetChannelPolicyResponse -> GetChannelPolicyResponse -> Bool
$c/= :: GetChannelPolicyResponse -> GetChannelPolicyResponse -> Bool
== :: GetChannelPolicyResponse -> GetChannelPolicyResponse -> Bool
$c== :: GetChannelPolicyResponse -> GetChannelPolicyResponse -> Bool
Prelude.Eq, ReadPrec [GetChannelPolicyResponse]
ReadPrec GetChannelPolicyResponse
Int -> ReadS GetChannelPolicyResponse
ReadS [GetChannelPolicyResponse]
(Int -> ReadS GetChannelPolicyResponse)
-> ReadS [GetChannelPolicyResponse]
-> ReadPrec GetChannelPolicyResponse
-> ReadPrec [GetChannelPolicyResponse]
-> Read GetChannelPolicyResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetChannelPolicyResponse]
$creadListPrec :: ReadPrec [GetChannelPolicyResponse]
readPrec :: ReadPrec GetChannelPolicyResponse
$creadPrec :: ReadPrec GetChannelPolicyResponse
readList :: ReadS [GetChannelPolicyResponse]
$creadList :: ReadS [GetChannelPolicyResponse]
readsPrec :: Int -> ReadS GetChannelPolicyResponse
$creadsPrec :: Int -> ReadS GetChannelPolicyResponse
Prelude.Read, Int -> GetChannelPolicyResponse -> ShowS
[GetChannelPolicyResponse] -> ShowS
GetChannelPolicyResponse -> String
(Int -> GetChannelPolicyResponse -> ShowS)
-> (GetChannelPolicyResponse -> String)
-> ([GetChannelPolicyResponse] -> ShowS)
-> Show GetChannelPolicyResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetChannelPolicyResponse] -> ShowS
$cshowList :: [GetChannelPolicyResponse] -> ShowS
show :: GetChannelPolicyResponse -> String
$cshow :: GetChannelPolicyResponse -> String
showsPrec :: Int -> GetChannelPolicyResponse -> ShowS
$cshowsPrec :: Int -> GetChannelPolicyResponse -> ShowS
Prelude.Show, (forall x.
GetChannelPolicyResponse -> Rep GetChannelPolicyResponse x)
-> (forall x.
Rep GetChannelPolicyResponse x -> GetChannelPolicyResponse)
-> Generic GetChannelPolicyResponse
forall x.
Rep GetChannelPolicyResponse x -> GetChannelPolicyResponse
forall x.
GetChannelPolicyResponse -> Rep GetChannelPolicyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetChannelPolicyResponse x -> GetChannelPolicyResponse
$cfrom :: forall x.
GetChannelPolicyResponse -> Rep GetChannelPolicyResponse x
Prelude.Generic)
newGetChannelPolicyResponse ::
Prelude.Int ->
GetChannelPolicyResponse
newGetChannelPolicyResponse :: Int -> GetChannelPolicyResponse
newGetChannelPolicyResponse Int
pHttpStatus_ =
GetChannelPolicyResponse' :: Maybe Text -> Int -> GetChannelPolicyResponse
GetChannelPolicyResponse'
{ $sel:policy:GetChannelPolicyResponse' :: Maybe Text
policy = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetChannelPolicyResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getChannelPolicyResponse_policy :: Lens.Lens' GetChannelPolicyResponse (Prelude.Maybe Prelude.Text)
getChannelPolicyResponse_policy :: (Maybe Text -> f (Maybe Text))
-> GetChannelPolicyResponse -> f GetChannelPolicyResponse
getChannelPolicyResponse_policy = (GetChannelPolicyResponse -> Maybe Text)
-> (GetChannelPolicyResponse
-> Maybe Text -> GetChannelPolicyResponse)
-> Lens
GetChannelPolicyResponse
GetChannelPolicyResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetChannelPolicyResponse' {Maybe Text
policy :: Maybe Text
$sel:policy:GetChannelPolicyResponse' :: GetChannelPolicyResponse -> Maybe Text
policy} -> Maybe Text
policy) (\s :: GetChannelPolicyResponse
s@GetChannelPolicyResponse' {} Maybe Text
a -> GetChannelPolicyResponse
s {$sel:policy:GetChannelPolicyResponse' :: Maybe Text
policy = Maybe Text
a} :: GetChannelPolicyResponse)
getChannelPolicyResponse_httpStatus :: Lens.Lens' GetChannelPolicyResponse Prelude.Int
getChannelPolicyResponse_httpStatus :: (Int -> f Int)
-> GetChannelPolicyResponse -> f GetChannelPolicyResponse
getChannelPolicyResponse_httpStatus = (GetChannelPolicyResponse -> Int)
-> (GetChannelPolicyResponse -> Int -> GetChannelPolicyResponse)
-> Lens GetChannelPolicyResponse GetChannelPolicyResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetChannelPolicyResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetChannelPolicyResponse' :: GetChannelPolicyResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetChannelPolicyResponse
s@GetChannelPolicyResponse' {} Int
a -> GetChannelPolicyResponse
s {$sel:httpStatus:GetChannelPolicyResponse' :: Int
httpStatus = Int
a} :: GetChannelPolicyResponse)
instance Prelude.NFData GetChannelPolicyResponse