{-# 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.MediaLive.UpdateChannelClass
(
UpdateChannelClass' (..),
newUpdateChannelClass',
updateChannelClass'_destinations,
updateChannelClass'_channelId,
updateChannelClass'_channelClass,
UpdateChannelClassResponse (..),
newUpdateChannelClassResponse,
updateChannelClassResponse_channel,
updateChannelClassResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaLive.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data UpdateChannelClass' = UpdateChannelClass''
{
UpdateChannelClass' -> Maybe [OutputDestination]
destinations :: Prelude.Maybe [OutputDestination],
UpdateChannelClass' -> Text
channelId :: Prelude.Text,
UpdateChannelClass' -> ChannelClass
channelClass :: ChannelClass
}
deriving (UpdateChannelClass' -> UpdateChannelClass' -> Bool
(UpdateChannelClass' -> UpdateChannelClass' -> Bool)
-> (UpdateChannelClass' -> UpdateChannelClass' -> Bool)
-> Eq UpdateChannelClass'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateChannelClass' -> UpdateChannelClass' -> Bool
$c/= :: UpdateChannelClass' -> UpdateChannelClass' -> Bool
== :: UpdateChannelClass' -> UpdateChannelClass' -> Bool
$c== :: UpdateChannelClass' -> UpdateChannelClass' -> Bool
Prelude.Eq, ReadPrec [UpdateChannelClass']
ReadPrec UpdateChannelClass'
Int -> ReadS UpdateChannelClass'
ReadS [UpdateChannelClass']
(Int -> ReadS UpdateChannelClass')
-> ReadS [UpdateChannelClass']
-> ReadPrec UpdateChannelClass'
-> ReadPrec [UpdateChannelClass']
-> Read UpdateChannelClass'
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateChannelClass']
$creadListPrec :: ReadPrec [UpdateChannelClass']
readPrec :: ReadPrec UpdateChannelClass'
$creadPrec :: ReadPrec UpdateChannelClass'
readList :: ReadS [UpdateChannelClass']
$creadList :: ReadS [UpdateChannelClass']
readsPrec :: Int -> ReadS UpdateChannelClass'
$creadsPrec :: Int -> ReadS UpdateChannelClass'
Prelude.Read, Int -> UpdateChannelClass' -> ShowS
[UpdateChannelClass'] -> ShowS
UpdateChannelClass' -> String
(Int -> UpdateChannelClass' -> ShowS)
-> (UpdateChannelClass' -> String)
-> ([UpdateChannelClass'] -> ShowS)
-> Show UpdateChannelClass'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateChannelClass'] -> ShowS
$cshowList :: [UpdateChannelClass'] -> ShowS
show :: UpdateChannelClass' -> String
$cshow :: UpdateChannelClass' -> String
showsPrec :: Int -> UpdateChannelClass' -> ShowS
$cshowsPrec :: Int -> UpdateChannelClass' -> ShowS
Prelude.Show, (forall x. UpdateChannelClass' -> Rep UpdateChannelClass' x)
-> (forall x. Rep UpdateChannelClass' x -> UpdateChannelClass')
-> Generic UpdateChannelClass'
forall x. Rep UpdateChannelClass' x -> UpdateChannelClass'
forall x. UpdateChannelClass' -> Rep UpdateChannelClass' x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateChannelClass' x -> UpdateChannelClass'
$cfrom :: forall x. UpdateChannelClass' -> Rep UpdateChannelClass' x
Prelude.Generic)
newUpdateChannelClass' ::
Prelude.Text ->
ChannelClass ->
UpdateChannelClass'
newUpdateChannelClass' :: Text -> ChannelClass -> UpdateChannelClass'
newUpdateChannelClass' Text
pChannelId_ ChannelClass
pChannelClass_ =
UpdateChannelClass'' :: Maybe [OutputDestination]
-> Text -> ChannelClass -> UpdateChannelClass'
UpdateChannelClass''
{ $sel:destinations:UpdateChannelClass'' :: Maybe [OutputDestination]
destinations =
Maybe [OutputDestination]
forall a. Maybe a
Prelude.Nothing,
$sel:channelId:UpdateChannelClass'' :: Text
channelId = Text
pChannelId_,
$sel:channelClass:UpdateChannelClass'' :: ChannelClass
channelClass = ChannelClass
pChannelClass_
}
updateChannelClass'_destinations :: Lens.Lens' UpdateChannelClass' (Prelude.Maybe [OutputDestination])
updateChannelClass'_destinations :: (Maybe [OutputDestination] -> f (Maybe [OutputDestination]))
-> UpdateChannelClass' -> f UpdateChannelClass'
updateChannelClass'_destinations = (UpdateChannelClass' -> Maybe [OutputDestination])
-> (UpdateChannelClass'
-> Maybe [OutputDestination] -> UpdateChannelClass')
-> Lens
UpdateChannelClass'
UpdateChannelClass'
(Maybe [OutputDestination])
(Maybe [OutputDestination])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateChannelClass'' {Maybe [OutputDestination]
destinations :: Maybe [OutputDestination]
$sel:destinations:UpdateChannelClass'' :: UpdateChannelClass' -> Maybe [OutputDestination]
destinations} -> Maybe [OutputDestination]
destinations) (\s :: UpdateChannelClass'
s@UpdateChannelClass'' {} Maybe [OutputDestination]
a -> UpdateChannelClass'
s {$sel:destinations:UpdateChannelClass'' :: Maybe [OutputDestination]
destinations = Maybe [OutputDestination]
a} :: UpdateChannelClass') ((Maybe [OutputDestination] -> f (Maybe [OutputDestination]))
-> UpdateChannelClass' -> f UpdateChannelClass')
-> ((Maybe [OutputDestination] -> f (Maybe [OutputDestination]))
-> Maybe [OutputDestination] -> f (Maybe [OutputDestination]))
-> (Maybe [OutputDestination] -> f (Maybe [OutputDestination]))
-> UpdateChannelClass'
-> f UpdateChannelClass'
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[OutputDestination]
[OutputDestination]
[OutputDestination]
[OutputDestination]
-> Iso
(Maybe [OutputDestination])
(Maybe [OutputDestination])
(Maybe [OutputDestination])
(Maybe [OutputDestination])
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
[OutputDestination]
[OutputDestination]
[OutputDestination]
[OutputDestination]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
updateChannelClass'_channelId :: Lens.Lens' UpdateChannelClass' Prelude.Text
updateChannelClass'_channelId :: (Text -> f Text) -> UpdateChannelClass' -> f UpdateChannelClass'
updateChannelClass'_channelId = (UpdateChannelClass' -> Text)
-> (UpdateChannelClass' -> Text -> UpdateChannelClass')
-> Lens UpdateChannelClass' UpdateChannelClass' Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateChannelClass'' {Text
channelId :: Text
$sel:channelId:UpdateChannelClass'' :: UpdateChannelClass' -> Text
channelId} -> Text
channelId) (\s :: UpdateChannelClass'
s@UpdateChannelClass'' {} Text
a -> UpdateChannelClass'
s {$sel:channelId:UpdateChannelClass'' :: Text
channelId = Text
a} :: UpdateChannelClass')
updateChannelClass'_channelClass :: Lens.Lens' UpdateChannelClass' ChannelClass
updateChannelClass'_channelClass :: (ChannelClass -> f ChannelClass)
-> UpdateChannelClass' -> f UpdateChannelClass'
updateChannelClass'_channelClass = (UpdateChannelClass' -> ChannelClass)
-> (UpdateChannelClass' -> ChannelClass -> UpdateChannelClass')
-> Lens
UpdateChannelClass' UpdateChannelClass' ChannelClass ChannelClass
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateChannelClass'' {ChannelClass
channelClass :: ChannelClass
$sel:channelClass:UpdateChannelClass'' :: UpdateChannelClass' -> ChannelClass
channelClass} -> ChannelClass
channelClass) (\s :: UpdateChannelClass'
s@UpdateChannelClass'' {} ChannelClass
a -> UpdateChannelClass'
s {$sel:channelClass:UpdateChannelClass'' :: ChannelClass
channelClass = ChannelClass
a} :: UpdateChannelClass')
instance Core.AWSRequest UpdateChannelClass' where
type
AWSResponse UpdateChannelClass' =
UpdateChannelClassResponse
request :: UpdateChannelClass' -> Request UpdateChannelClass'
request = Service -> UpdateChannelClass' -> Request UpdateChannelClass'
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateChannelClass'
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateChannelClass')))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateChannelClass'))
-> Logger
-> Service
-> Proxy UpdateChannelClass'
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateChannelClass')))
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 Channel -> Int -> UpdateChannelClassResponse
UpdateChannelClassResponse'
(Maybe Channel -> Int -> UpdateChannelClassResponse)
-> Either String (Maybe Channel)
-> Either String (Int -> UpdateChannelClassResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Channel)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"channel")
Either String (Int -> UpdateChannelClassResponse)
-> Either String Int -> Either String UpdateChannelClassResponse
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 UpdateChannelClass'
instance Prelude.NFData UpdateChannelClass'
instance Core.ToHeaders UpdateChannelClass' where
toHeaders :: UpdateChannelClass' -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateChannelClass' -> 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.ToJSON UpdateChannelClass' where
toJSON :: UpdateChannelClass' -> Value
toJSON UpdateChannelClass'' {Maybe [OutputDestination]
Text
ChannelClass
channelClass :: ChannelClass
channelId :: Text
destinations :: Maybe [OutputDestination]
$sel:channelClass:UpdateChannelClass'' :: UpdateChannelClass' -> ChannelClass
$sel:channelId:UpdateChannelClass'' :: UpdateChannelClass' -> Text
$sel:destinations:UpdateChannelClass'' :: UpdateChannelClass' -> Maybe [OutputDestination]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"destinations" Text -> [OutputDestination] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([OutputDestination] -> Pair)
-> Maybe [OutputDestination] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [OutputDestination]
destinations,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"channelClass" Text -> ChannelClass -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ChannelClass
channelClass)
]
)
instance Core.ToPath UpdateChannelClass' where
toPath :: UpdateChannelClass' -> ByteString
toPath UpdateChannelClass'' {Maybe [OutputDestination]
Text
ChannelClass
channelClass :: ChannelClass
channelId :: Text
destinations :: Maybe [OutputDestination]
$sel:channelClass:UpdateChannelClass'' :: UpdateChannelClass' -> ChannelClass
$sel:channelId:UpdateChannelClass'' :: UpdateChannelClass' -> Text
$sel:destinations:UpdateChannelClass'' :: UpdateChannelClass' -> Maybe [OutputDestination]
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/prod/channels/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
channelId,
ByteString
"/channelClass"
]
instance Core.ToQuery UpdateChannelClass' where
toQuery :: UpdateChannelClass' -> QueryString
toQuery = QueryString -> UpdateChannelClass' -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateChannelClassResponse = UpdateChannelClassResponse'
{ UpdateChannelClassResponse -> Maybe Channel
channel :: Prelude.Maybe Channel,
UpdateChannelClassResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateChannelClassResponse -> UpdateChannelClassResponse -> Bool
(UpdateChannelClassResponse -> UpdateChannelClassResponse -> Bool)
-> (UpdateChannelClassResponse
-> UpdateChannelClassResponse -> Bool)
-> Eq UpdateChannelClassResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateChannelClassResponse -> UpdateChannelClassResponse -> Bool
$c/= :: UpdateChannelClassResponse -> UpdateChannelClassResponse -> Bool
== :: UpdateChannelClassResponse -> UpdateChannelClassResponse -> Bool
$c== :: UpdateChannelClassResponse -> UpdateChannelClassResponse -> Bool
Prelude.Eq, ReadPrec [UpdateChannelClassResponse]
ReadPrec UpdateChannelClassResponse
Int -> ReadS UpdateChannelClassResponse
ReadS [UpdateChannelClassResponse]
(Int -> ReadS UpdateChannelClassResponse)
-> ReadS [UpdateChannelClassResponse]
-> ReadPrec UpdateChannelClassResponse
-> ReadPrec [UpdateChannelClassResponse]
-> Read UpdateChannelClassResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateChannelClassResponse]
$creadListPrec :: ReadPrec [UpdateChannelClassResponse]
readPrec :: ReadPrec UpdateChannelClassResponse
$creadPrec :: ReadPrec UpdateChannelClassResponse
readList :: ReadS [UpdateChannelClassResponse]
$creadList :: ReadS [UpdateChannelClassResponse]
readsPrec :: Int -> ReadS UpdateChannelClassResponse
$creadsPrec :: Int -> ReadS UpdateChannelClassResponse
Prelude.Read, Int -> UpdateChannelClassResponse -> ShowS
[UpdateChannelClassResponse] -> ShowS
UpdateChannelClassResponse -> String
(Int -> UpdateChannelClassResponse -> ShowS)
-> (UpdateChannelClassResponse -> String)
-> ([UpdateChannelClassResponse] -> ShowS)
-> Show UpdateChannelClassResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateChannelClassResponse] -> ShowS
$cshowList :: [UpdateChannelClassResponse] -> ShowS
show :: UpdateChannelClassResponse -> String
$cshow :: UpdateChannelClassResponse -> String
showsPrec :: Int -> UpdateChannelClassResponse -> ShowS
$cshowsPrec :: Int -> UpdateChannelClassResponse -> ShowS
Prelude.Show, (forall x.
UpdateChannelClassResponse -> Rep UpdateChannelClassResponse x)
-> (forall x.
Rep UpdateChannelClassResponse x -> UpdateChannelClassResponse)
-> Generic UpdateChannelClassResponse
forall x.
Rep UpdateChannelClassResponse x -> UpdateChannelClassResponse
forall x.
UpdateChannelClassResponse -> Rep UpdateChannelClassResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateChannelClassResponse x -> UpdateChannelClassResponse
$cfrom :: forall x.
UpdateChannelClassResponse -> Rep UpdateChannelClassResponse x
Prelude.Generic)
newUpdateChannelClassResponse ::
Prelude.Int ->
UpdateChannelClassResponse
newUpdateChannelClassResponse :: Int -> UpdateChannelClassResponse
newUpdateChannelClassResponse Int
pHttpStatus_ =
UpdateChannelClassResponse' :: Maybe Channel -> Int -> UpdateChannelClassResponse
UpdateChannelClassResponse'
{ $sel:channel:UpdateChannelClassResponse' :: Maybe Channel
channel =
Maybe Channel
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateChannelClassResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateChannelClassResponse_channel :: Lens.Lens' UpdateChannelClassResponse (Prelude.Maybe Channel)
updateChannelClassResponse_channel :: (Maybe Channel -> f (Maybe Channel))
-> UpdateChannelClassResponse -> f UpdateChannelClassResponse
updateChannelClassResponse_channel = (UpdateChannelClassResponse -> Maybe Channel)
-> (UpdateChannelClassResponse
-> Maybe Channel -> UpdateChannelClassResponse)
-> Lens
UpdateChannelClassResponse
UpdateChannelClassResponse
(Maybe Channel)
(Maybe Channel)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateChannelClassResponse' {Maybe Channel
channel :: Maybe Channel
$sel:channel:UpdateChannelClassResponse' :: UpdateChannelClassResponse -> Maybe Channel
channel} -> Maybe Channel
channel) (\s :: UpdateChannelClassResponse
s@UpdateChannelClassResponse' {} Maybe Channel
a -> UpdateChannelClassResponse
s {$sel:channel:UpdateChannelClassResponse' :: Maybe Channel
channel = Maybe Channel
a} :: UpdateChannelClassResponse)
updateChannelClassResponse_httpStatus :: Lens.Lens' UpdateChannelClassResponse Prelude.Int
updateChannelClassResponse_httpStatus :: (Int -> f Int)
-> UpdateChannelClassResponse -> f UpdateChannelClassResponse
updateChannelClassResponse_httpStatus = (UpdateChannelClassResponse -> Int)
-> (UpdateChannelClassResponse
-> Int -> UpdateChannelClassResponse)
-> Lens
UpdateChannelClassResponse UpdateChannelClassResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateChannelClassResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateChannelClassResponse' :: UpdateChannelClassResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateChannelClassResponse
s@UpdateChannelClassResponse' {} Int
a -> UpdateChannelClassResponse
s {$sel:httpStatus:UpdateChannelClassResponse' :: Int
httpStatus = Int
a} :: UpdateChannelClassResponse)
instance Prelude.NFData UpdateChannelClassResponse