{-# 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.Chime.UpdateChannel
(
UpdateChannel (..),
newUpdateChannel,
updateChannel_chimeBearer,
updateChannel_metadata,
updateChannel_channelArn,
updateChannel_name,
updateChannel_mode,
UpdateChannelResponse (..),
newUpdateChannelResponse,
updateChannelResponse_channelArn,
updateChannelResponse_httpStatus,
)
where
import Amazonka.Chime.Types
import qualified Amazonka.Core as Core
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 UpdateChannel = UpdateChannel'
{
UpdateChannel -> Maybe Text
chimeBearer :: Prelude.Maybe Prelude.Text,
UpdateChannel -> Maybe (Sensitive Text)
metadata :: Prelude.Maybe (Core.Sensitive Prelude.Text),
UpdateChannel -> Text
channelArn :: Prelude.Text,
UpdateChannel -> Sensitive Text
name :: Core.Sensitive Prelude.Text,
UpdateChannel -> ChannelMode
mode :: ChannelMode
}
deriving (UpdateChannel -> UpdateChannel -> Bool
(UpdateChannel -> UpdateChannel -> Bool)
-> (UpdateChannel -> UpdateChannel -> Bool) -> Eq UpdateChannel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateChannel -> UpdateChannel -> Bool
$c/= :: UpdateChannel -> UpdateChannel -> Bool
== :: UpdateChannel -> UpdateChannel -> Bool
$c== :: UpdateChannel -> UpdateChannel -> Bool
Prelude.Eq, Int -> UpdateChannel -> ShowS
[UpdateChannel] -> ShowS
UpdateChannel -> String
(Int -> UpdateChannel -> ShowS)
-> (UpdateChannel -> String)
-> ([UpdateChannel] -> ShowS)
-> Show UpdateChannel
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateChannel] -> ShowS
$cshowList :: [UpdateChannel] -> ShowS
show :: UpdateChannel -> String
$cshow :: UpdateChannel -> String
showsPrec :: Int -> UpdateChannel -> ShowS
$cshowsPrec :: Int -> UpdateChannel -> ShowS
Prelude.Show, (forall x. UpdateChannel -> Rep UpdateChannel x)
-> (forall x. Rep UpdateChannel x -> UpdateChannel)
-> Generic UpdateChannel
forall x. Rep UpdateChannel x -> UpdateChannel
forall x. UpdateChannel -> Rep UpdateChannel x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateChannel x -> UpdateChannel
$cfrom :: forall x. UpdateChannel -> Rep UpdateChannel x
Prelude.Generic)
newUpdateChannel ::
Prelude.Text ->
Prelude.Text ->
ChannelMode ->
UpdateChannel
newUpdateChannel :: Text -> Text -> ChannelMode -> UpdateChannel
newUpdateChannel Text
pChannelArn_ Text
pName_ ChannelMode
pMode_ =
UpdateChannel' :: Maybe Text
-> Maybe (Sensitive Text)
-> Text
-> Sensitive Text
-> ChannelMode
-> UpdateChannel
UpdateChannel'
{ $sel:chimeBearer:UpdateChannel' :: Maybe Text
chimeBearer = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:metadata:UpdateChannel' :: Maybe (Sensitive Text)
metadata = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
$sel:channelArn:UpdateChannel' :: Text
channelArn = Text
pChannelArn_,
$sel:name:UpdateChannel' :: Sensitive Text
name = Tagged Text (Identity Text)
-> Tagged (Sensitive Text) (Identity (Sensitive Text))
forall a. Iso' (Sensitive a) a
Core._Sensitive (Tagged Text (Identity Text)
-> Tagged (Sensitive Text) (Identity (Sensitive Text)))
-> Text -> Sensitive Text
forall t b. AReview t b -> b -> t
Lens.# Text
pName_,
$sel:mode:UpdateChannel' :: ChannelMode
mode = ChannelMode
pMode_
}
updateChannel_chimeBearer :: Lens.Lens' UpdateChannel (Prelude.Maybe Prelude.Text)
updateChannel_chimeBearer :: (Maybe Text -> f (Maybe Text)) -> UpdateChannel -> f UpdateChannel
updateChannel_chimeBearer = (UpdateChannel -> Maybe Text)
-> (UpdateChannel -> Maybe Text -> UpdateChannel)
-> Lens UpdateChannel UpdateChannel (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateChannel' {Maybe Text
chimeBearer :: Maybe Text
$sel:chimeBearer:UpdateChannel' :: UpdateChannel -> Maybe Text
chimeBearer} -> Maybe Text
chimeBearer) (\s :: UpdateChannel
s@UpdateChannel' {} Maybe Text
a -> UpdateChannel
s {$sel:chimeBearer:UpdateChannel' :: Maybe Text
chimeBearer = Maybe Text
a} :: UpdateChannel)
updateChannel_metadata :: Lens.Lens' UpdateChannel (Prelude.Maybe Prelude.Text)
updateChannel_metadata :: (Maybe Text -> f (Maybe Text)) -> UpdateChannel -> f UpdateChannel
updateChannel_metadata = (UpdateChannel -> Maybe (Sensitive Text))
-> (UpdateChannel -> Maybe (Sensitive Text) -> UpdateChannel)
-> Lens
UpdateChannel
UpdateChannel
(Maybe (Sensitive Text))
(Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateChannel' {Maybe (Sensitive Text)
metadata :: Maybe (Sensitive Text)
$sel:metadata:UpdateChannel' :: UpdateChannel -> Maybe (Sensitive Text)
metadata} -> Maybe (Sensitive Text)
metadata) (\s :: UpdateChannel
s@UpdateChannel' {} Maybe (Sensitive Text)
a -> UpdateChannel
s {$sel:metadata:UpdateChannel' :: Maybe (Sensitive Text)
metadata = Maybe (Sensitive Text)
a} :: UpdateChannel) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> UpdateChannel -> f UpdateChannel)
-> ((Maybe Text -> f (Maybe Text))
-> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> UpdateChannel
-> f UpdateChannel
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
(Maybe (Sensitive Text))
(Maybe (Sensitive Text))
(Maybe Text)
(Maybe Text)
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 (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive
updateChannel_channelArn :: Lens.Lens' UpdateChannel Prelude.Text
updateChannel_channelArn :: (Text -> f Text) -> UpdateChannel -> f UpdateChannel
updateChannel_channelArn = (UpdateChannel -> Text)
-> (UpdateChannel -> Text -> UpdateChannel)
-> Lens UpdateChannel UpdateChannel Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateChannel' {Text
channelArn :: Text
$sel:channelArn:UpdateChannel' :: UpdateChannel -> Text
channelArn} -> Text
channelArn) (\s :: UpdateChannel
s@UpdateChannel' {} Text
a -> UpdateChannel
s {$sel:channelArn:UpdateChannel' :: Text
channelArn = Text
a} :: UpdateChannel)
updateChannel_name :: Lens.Lens' UpdateChannel Prelude.Text
updateChannel_name :: (Text -> f Text) -> UpdateChannel -> f UpdateChannel
updateChannel_name = (UpdateChannel -> Sensitive Text)
-> (UpdateChannel -> Sensitive Text -> UpdateChannel)
-> Lens
UpdateChannel UpdateChannel (Sensitive Text) (Sensitive Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateChannel' {Sensitive Text
name :: Sensitive Text
$sel:name:UpdateChannel' :: UpdateChannel -> Sensitive Text
name} -> Sensitive Text
name) (\s :: UpdateChannel
s@UpdateChannel' {} Sensitive Text
a -> UpdateChannel
s {$sel:name:UpdateChannel' :: Sensitive Text
name = Sensitive Text
a} :: UpdateChannel) ((Sensitive Text -> f (Sensitive Text))
-> UpdateChannel -> f UpdateChannel)
-> ((Text -> f Text) -> Sensitive Text -> f (Sensitive Text))
-> (Text -> f Text)
-> UpdateChannel
-> f UpdateChannel
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> f Text) -> Sensitive Text -> f (Sensitive Text)
forall a. Iso' (Sensitive a) a
Core._Sensitive
updateChannel_mode :: Lens.Lens' UpdateChannel ChannelMode
updateChannel_mode :: (ChannelMode -> f ChannelMode) -> UpdateChannel -> f UpdateChannel
updateChannel_mode = (UpdateChannel -> ChannelMode)
-> (UpdateChannel -> ChannelMode -> UpdateChannel)
-> Lens UpdateChannel UpdateChannel ChannelMode ChannelMode
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateChannel' {ChannelMode
mode :: ChannelMode
$sel:mode:UpdateChannel' :: UpdateChannel -> ChannelMode
mode} -> ChannelMode
mode) (\s :: UpdateChannel
s@UpdateChannel' {} ChannelMode
a -> UpdateChannel
s {$sel:mode:UpdateChannel' :: ChannelMode
mode = ChannelMode
a} :: UpdateChannel)
instance Core.AWSRequest UpdateChannel where
type
AWSResponse UpdateChannel =
UpdateChannelResponse
request :: UpdateChannel -> Request UpdateChannel
request = Service -> UpdateChannel -> Request UpdateChannel
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateChannel
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateChannel)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateChannel))
-> Logger
-> Service
-> Proxy UpdateChannel
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateChannel)))
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 -> UpdateChannelResponse
UpdateChannelResponse'
(Maybe Text -> Int -> UpdateChannelResponse)
-> Either String (Maybe Text)
-> Either String (Int -> UpdateChannelResponse)
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
"ChannelArn")
Either String (Int -> UpdateChannelResponse)
-> Either String Int -> Either String UpdateChannelResponse
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 UpdateChannel
instance Prelude.NFData UpdateChannel
instance Core.ToHeaders UpdateChannel where
toHeaders :: UpdateChannel -> ResponseHeaders
toHeaders UpdateChannel' {Maybe Text
Maybe (Sensitive Text)
Text
Sensitive Text
ChannelMode
mode :: ChannelMode
name :: Sensitive Text
channelArn :: Text
metadata :: Maybe (Sensitive Text)
chimeBearer :: Maybe Text
$sel:mode:UpdateChannel' :: UpdateChannel -> ChannelMode
$sel:name:UpdateChannel' :: UpdateChannel -> Sensitive Text
$sel:channelArn:UpdateChannel' :: UpdateChannel -> Text
$sel:metadata:UpdateChannel' :: UpdateChannel -> Maybe (Sensitive Text)
$sel:chimeBearer:UpdateChannel' :: UpdateChannel -> Maybe Text
..} =
[ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[HeaderName
"x-amz-chime-bearer" HeaderName -> Maybe Text -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# Maybe Text
chimeBearer]
instance Core.ToJSON UpdateChannel where
toJSON :: UpdateChannel -> Value
toJSON UpdateChannel' {Maybe Text
Maybe (Sensitive Text)
Text
Sensitive Text
ChannelMode
mode :: ChannelMode
name :: Sensitive Text
channelArn :: Text
metadata :: Maybe (Sensitive Text)
chimeBearer :: Maybe Text
$sel:mode:UpdateChannel' :: UpdateChannel -> ChannelMode
$sel:name:UpdateChannel' :: UpdateChannel -> Sensitive Text
$sel:channelArn:UpdateChannel' :: UpdateChannel -> Text
$sel:metadata:UpdateChannel' :: UpdateChannel -> Maybe (Sensitive Text)
$sel:chimeBearer:UpdateChannel' :: UpdateChannel -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Metadata" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Sensitive Text -> Pair) -> Maybe (Sensitive Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive Text)
metadata,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Name" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Sensitive Text
name),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Mode" Text -> ChannelMode -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ChannelMode
mode)
]
)
instance Core.ToPath UpdateChannel where
toPath :: UpdateChannel -> ByteString
toPath UpdateChannel' {Maybe Text
Maybe (Sensitive Text)
Text
Sensitive Text
ChannelMode
mode :: ChannelMode
name :: Sensitive Text
channelArn :: Text
metadata :: Maybe (Sensitive Text)
chimeBearer :: Maybe Text
$sel:mode:UpdateChannel' :: UpdateChannel -> ChannelMode
$sel:name:UpdateChannel' :: UpdateChannel -> Sensitive Text
$sel:channelArn:UpdateChannel' :: UpdateChannel -> Text
$sel:metadata:UpdateChannel' :: UpdateChannel -> Maybe (Sensitive Text)
$sel:chimeBearer:UpdateChannel' :: UpdateChannel -> Maybe Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/channels/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
channelArn]
instance Core.ToQuery UpdateChannel where
toQuery :: UpdateChannel -> QueryString
toQuery = QueryString -> UpdateChannel -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateChannelResponse = UpdateChannelResponse'
{
UpdateChannelResponse -> Maybe Text
channelArn :: Prelude.Maybe Prelude.Text,
UpdateChannelResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateChannelResponse -> UpdateChannelResponse -> Bool
(UpdateChannelResponse -> UpdateChannelResponse -> Bool)
-> (UpdateChannelResponse -> UpdateChannelResponse -> Bool)
-> Eq UpdateChannelResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateChannelResponse -> UpdateChannelResponse -> Bool
$c/= :: UpdateChannelResponse -> UpdateChannelResponse -> Bool
== :: UpdateChannelResponse -> UpdateChannelResponse -> Bool
$c== :: UpdateChannelResponse -> UpdateChannelResponse -> Bool
Prelude.Eq, ReadPrec [UpdateChannelResponse]
ReadPrec UpdateChannelResponse
Int -> ReadS UpdateChannelResponse
ReadS [UpdateChannelResponse]
(Int -> ReadS UpdateChannelResponse)
-> ReadS [UpdateChannelResponse]
-> ReadPrec UpdateChannelResponse
-> ReadPrec [UpdateChannelResponse]
-> Read UpdateChannelResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateChannelResponse]
$creadListPrec :: ReadPrec [UpdateChannelResponse]
readPrec :: ReadPrec UpdateChannelResponse
$creadPrec :: ReadPrec UpdateChannelResponse
readList :: ReadS [UpdateChannelResponse]
$creadList :: ReadS [UpdateChannelResponse]
readsPrec :: Int -> ReadS UpdateChannelResponse
$creadsPrec :: Int -> ReadS UpdateChannelResponse
Prelude.Read, Int -> UpdateChannelResponse -> ShowS
[UpdateChannelResponse] -> ShowS
UpdateChannelResponse -> String
(Int -> UpdateChannelResponse -> ShowS)
-> (UpdateChannelResponse -> String)
-> ([UpdateChannelResponse] -> ShowS)
-> Show UpdateChannelResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateChannelResponse] -> ShowS
$cshowList :: [UpdateChannelResponse] -> ShowS
show :: UpdateChannelResponse -> String
$cshow :: UpdateChannelResponse -> String
showsPrec :: Int -> UpdateChannelResponse -> ShowS
$cshowsPrec :: Int -> UpdateChannelResponse -> ShowS
Prelude.Show, (forall x. UpdateChannelResponse -> Rep UpdateChannelResponse x)
-> (forall x. Rep UpdateChannelResponse x -> UpdateChannelResponse)
-> Generic UpdateChannelResponse
forall x. Rep UpdateChannelResponse x -> UpdateChannelResponse
forall x. UpdateChannelResponse -> Rep UpdateChannelResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateChannelResponse x -> UpdateChannelResponse
$cfrom :: forall x. UpdateChannelResponse -> Rep UpdateChannelResponse x
Prelude.Generic)
newUpdateChannelResponse ::
Prelude.Int ->
UpdateChannelResponse
newUpdateChannelResponse :: Int -> UpdateChannelResponse
newUpdateChannelResponse Int
pHttpStatus_ =
UpdateChannelResponse' :: Maybe Text -> Int -> UpdateChannelResponse
UpdateChannelResponse'
{ $sel:channelArn:UpdateChannelResponse' :: Maybe Text
channelArn =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateChannelResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateChannelResponse_channelArn :: Lens.Lens' UpdateChannelResponse (Prelude.Maybe Prelude.Text)
updateChannelResponse_channelArn :: (Maybe Text -> f (Maybe Text))
-> UpdateChannelResponse -> f UpdateChannelResponse
updateChannelResponse_channelArn = (UpdateChannelResponse -> Maybe Text)
-> (UpdateChannelResponse -> Maybe Text -> UpdateChannelResponse)
-> Lens
UpdateChannelResponse
UpdateChannelResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateChannelResponse' {Maybe Text
channelArn :: Maybe Text
$sel:channelArn:UpdateChannelResponse' :: UpdateChannelResponse -> Maybe Text
channelArn} -> Maybe Text
channelArn) (\s :: UpdateChannelResponse
s@UpdateChannelResponse' {} Maybe Text
a -> UpdateChannelResponse
s {$sel:channelArn:UpdateChannelResponse' :: Maybe Text
channelArn = Maybe Text
a} :: UpdateChannelResponse)
updateChannelResponse_httpStatus :: Lens.Lens' UpdateChannelResponse Prelude.Int
updateChannelResponse_httpStatus :: (Int -> f Int) -> UpdateChannelResponse -> f UpdateChannelResponse
updateChannelResponse_httpStatus = (UpdateChannelResponse -> Int)
-> (UpdateChannelResponse -> Int -> UpdateChannelResponse)
-> Lens UpdateChannelResponse UpdateChannelResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateChannelResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateChannelResponse' :: UpdateChannelResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateChannelResponse
s@UpdateChannelResponse' {} Int
a -> UpdateChannelResponse
s {$sel:httpStatus:UpdateChannelResponse' :: Int
httpStatus = Int
a} :: UpdateChannelResponse)
instance Prelude.NFData UpdateChannelResponse