{-# 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.CloudFront.CreateStreamingDistribution
(
CreateStreamingDistribution (..),
newCreateStreamingDistribution,
createStreamingDistribution_streamingDistributionConfig,
CreateStreamingDistributionResponse (..),
newCreateStreamingDistributionResponse,
createStreamingDistributionResponse_eTag,
createStreamingDistributionResponse_location,
createStreamingDistributionResponse_streamingDistribution,
createStreamingDistributionResponse_httpStatus,
)
where
import Amazonka.CloudFront.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 CreateStreamingDistribution = CreateStreamingDistribution'
{
CreateStreamingDistribution -> StreamingDistributionConfig
streamingDistributionConfig :: StreamingDistributionConfig
}
deriving (CreateStreamingDistribution -> CreateStreamingDistribution -> Bool
(CreateStreamingDistribution
-> CreateStreamingDistribution -> Bool)
-> (CreateStreamingDistribution
-> CreateStreamingDistribution -> Bool)
-> Eq CreateStreamingDistribution
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateStreamingDistribution -> CreateStreamingDistribution -> Bool
$c/= :: CreateStreamingDistribution -> CreateStreamingDistribution -> Bool
== :: CreateStreamingDistribution -> CreateStreamingDistribution -> Bool
$c== :: CreateStreamingDistribution -> CreateStreamingDistribution -> Bool
Prelude.Eq, ReadPrec [CreateStreamingDistribution]
ReadPrec CreateStreamingDistribution
Int -> ReadS CreateStreamingDistribution
ReadS [CreateStreamingDistribution]
(Int -> ReadS CreateStreamingDistribution)
-> ReadS [CreateStreamingDistribution]
-> ReadPrec CreateStreamingDistribution
-> ReadPrec [CreateStreamingDistribution]
-> Read CreateStreamingDistribution
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateStreamingDistribution]
$creadListPrec :: ReadPrec [CreateStreamingDistribution]
readPrec :: ReadPrec CreateStreamingDistribution
$creadPrec :: ReadPrec CreateStreamingDistribution
readList :: ReadS [CreateStreamingDistribution]
$creadList :: ReadS [CreateStreamingDistribution]
readsPrec :: Int -> ReadS CreateStreamingDistribution
$creadsPrec :: Int -> ReadS CreateStreamingDistribution
Prelude.Read, Int -> CreateStreamingDistribution -> ShowS
[CreateStreamingDistribution] -> ShowS
CreateStreamingDistribution -> String
(Int -> CreateStreamingDistribution -> ShowS)
-> (CreateStreamingDistribution -> String)
-> ([CreateStreamingDistribution] -> ShowS)
-> Show CreateStreamingDistribution
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateStreamingDistribution] -> ShowS
$cshowList :: [CreateStreamingDistribution] -> ShowS
show :: CreateStreamingDistribution -> String
$cshow :: CreateStreamingDistribution -> String
showsPrec :: Int -> CreateStreamingDistribution -> ShowS
$cshowsPrec :: Int -> CreateStreamingDistribution -> ShowS
Prelude.Show, (forall x.
CreateStreamingDistribution -> Rep CreateStreamingDistribution x)
-> (forall x.
Rep CreateStreamingDistribution x -> CreateStreamingDistribution)
-> Generic CreateStreamingDistribution
forall x.
Rep CreateStreamingDistribution x -> CreateStreamingDistribution
forall x.
CreateStreamingDistribution -> Rep CreateStreamingDistribution x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateStreamingDistribution x -> CreateStreamingDistribution
$cfrom :: forall x.
CreateStreamingDistribution -> Rep CreateStreamingDistribution x
Prelude.Generic)
newCreateStreamingDistribution ::
StreamingDistributionConfig ->
CreateStreamingDistribution
newCreateStreamingDistribution :: StreamingDistributionConfig -> CreateStreamingDistribution
newCreateStreamingDistribution
StreamingDistributionConfig
pStreamingDistributionConfig_ =
CreateStreamingDistribution' :: StreamingDistributionConfig -> CreateStreamingDistribution
CreateStreamingDistribution'
{ $sel:streamingDistributionConfig:CreateStreamingDistribution' :: StreamingDistributionConfig
streamingDistributionConfig =
StreamingDistributionConfig
pStreamingDistributionConfig_
}
createStreamingDistribution_streamingDistributionConfig :: Lens.Lens' CreateStreamingDistribution StreamingDistributionConfig
createStreamingDistribution_streamingDistributionConfig :: (StreamingDistributionConfig -> f StreamingDistributionConfig)
-> CreateStreamingDistribution -> f CreateStreamingDistribution
createStreamingDistribution_streamingDistributionConfig = (CreateStreamingDistribution -> StreamingDistributionConfig)
-> (CreateStreamingDistribution
-> StreamingDistributionConfig -> CreateStreamingDistribution)
-> Lens
CreateStreamingDistribution
CreateStreamingDistribution
StreamingDistributionConfig
StreamingDistributionConfig
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStreamingDistribution' {StreamingDistributionConfig
streamingDistributionConfig :: StreamingDistributionConfig
$sel:streamingDistributionConfig:CreateStreamingDistribution' :: CreateStreamingDistribution -> StreamingDistributionConfig
streamingDistributionConfig} -> StreamingDistributionConfig
streamingDistributionConfig) (\s :: CreateStreamingDistribution
s@CreateStreamingDistribution' {} StreamingDistributionConfig
a -> CreateStreamingDistribution
s {$sel:streamingDistributionConfig:CreateStreamingDistribution' :: StreamingDistributionConfig
streamingDistributionConfig = StreamingDistributionConfig
a} :: CreateStreamingDistribution)
instance Core.AWSRequest CreateStreamingDistribution where
type
AWSResponse CreateStreamingDistribution =
CreateStreamingDistributionResponse
request :: CreateStreamingDistribution -> Request CreateStreamingDistribution
request = Service
-> CreateStreamingDistribution
-> Request CreateStreamingDistribution
forall a. (ToRequest a, ToElement a) => Service -> a -> Request a
Request.postXML Service
defaultService
response :: Logger
-> Service
-> Proxy CreateStreamingDistribution
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateStreamingDistribution)))
response =
(Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse CreateStreamingDistribution))
-> Logger
-> Service
-> Proxy CreateStreamingDistribution
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateStreamingDistribution)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXML
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe Text
-> Maybe Text
-> Maybe StreamingDistribution
-> Int
-> CreateStreamingDistributionResponse
CreateStreamingDistributionResponse'
(Maybe Text
-> Maybe Text
-> Maybe StreamingDistribution
-> Int
-> CreateStreamingDistributionResponse)
-> Either String (Maybe Text)
-> Either
String
(Maybe Text
-> Maybe StreamingDistribution
-> Int
-> CreateStreamingDistributionResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (ResponseHeaders
h ResponseHeaders -> HeaderName -> Either String (Maybe Text)
forall a.
FromText a =>
ResponseHeaders -> HeaderName -> Either String (Maybe a)
Core..#? HeaderName
"ETag")
Either
String
(Maybe Text
-> Maybe StreamingDistribution
-> Int
-> CreateStreamingDistributionResponse)
-> Either String (Maybe Text)
-> Either
String
(Maybe StreamingDistribution
-> Int -> CreateStreamingDistributionResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (ResponseHeaders
h ResponseHeaders -> HeaderName -> Either String (Maybe Text)
forall a.
FromText a =>
ResponseHeaders -> HeaderName -> Either String (Maybe a)
Core..#? HeaderName
"Location")
Either
String
(Maybe StreamingDistribution
-> Int -> CreateStreamingDistributionResponse)
-> Either String (Maybe StreamingDistribution)
-> Either String (Int -> CreateStreamingDistributionResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node] -> Either String (Maybe StreamingDistribution)
forall a. FromXML a => [Node] -> Either String a
Core.parseXML [Node]
x)
Either String (Int -> CreateStreamingDistributionResponse)
-> Either String Int
-> Either String CreateStreamingDistributionResponse
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 CreateStreamingDistribution
instance Prelude.NFData CreateStreamingDistribution
instance Core.ToElement CreateStreamingDistribution where
toElement :: CreateStreamingDistribution -> Element
toElement CreateStreamingDistribution' {StreamingDistributionConfig
streamingDistributionConfig :: StreamingDistributionConfig
$sel:streamingDistributionConfig:CreateStreamingDistribution' :: CreateStreamingDistribution -> StreamingDistributionConfig
..} =
Name -> StreamingDistributionConfig -> Element
forall a. ToXML a => Name -> a -> Element
Core.mkElement
Name
"{http://cloudfront.amazonaws.com/doc/2020-05-31/}StreamingDistributionConfig"
StreamingDistributionConfig
streamingDistributionConfig
instance Core.ToHeaders CreateStreamingDistribution where
toHeaders :: CreateStreamingDistribution -> ResponseHeaders
toHeaders = ResponseHeaders -> CreateStreamingDistribution -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath CreateStreamingDistribution where
toPath :: CreateStreamingDistribution -> ByteString
toPath =
ByteString -> CreateStreamingDistribution -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/2020-05-31/streaming-distribution"
instance Core.ToQuery CreateStreamingDistribution where
toQuery :: CreateStreamingDistribution -> QueryString
toQuery = QueryString -> CreateStreamingDistribution -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateStreamingDistributionResponse = CreateStreamingDistributionResponse'
{
CreateStreamingDistributionResponse -> Maybe Text
eTag :: Prelude.Maybe Prelude.Text,
CreateStreamingDistributionResponse -> Maybe Text
location :: Prelude.Maybe Prelude.Text,
CreateStreamingDistributionResponse -> Maybe StreamingDistribution
streamingDistribution :: Prelude.Maybe StreamingDistribution,
CreateStreamingDistributionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateStreamingDistributionResponse
-> CreateStreamingDistributionResponse -> Bool
(CreateStreamingDistributionResponse
-> CreateStreamingDistributionResponse -> Bool)
-> (CreateStreamingDistributionResponse
-> CreateStreamingDistributionResponse -> Bool)
-> Eq CreateStreamingDistributionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateStreamingDistributionResponse
-> CreateStreamingDistributionResponse -> Bool
$c/= :: CreateStreamingDistributionResponse
-> CreateStreamingDistributionResponse -> Bool
== :: CreateStreamingDistributionResponse
-> CreateStreamingDistributionResponse -> Bool
$c== :: CreateStreamingDistributionResponse
-> CreateStreamingDistributionResponse -> Bool
Prelude.Eq, ReadPrec [CreateStreamingDistributionResponse]
ReadPrec CreateStreamingDistributionResponse
Int -> ReadS CreateStreamingDistributionResponse
ReadS [CreateStreamingDistributionResponse]
(Int -> ReadS CreateStreamingDistributionResponse)
-> ReadS [CreateStreamingDistributionResponse]
-> ReadPrec CreateStreamingDistributionResponse
-> ReadPrec [CreateStreamingDistributionResponse]
-> Read CreateStreamingDistributionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateStreamingDistributionResponse]
$creadListPrec :: ReadPrec [CreateStreamingDistributionResponse]
readPrec :: ReadPrec CreateStreamingDistributionResponse
$creadPrec :: ReadPrec CreateStreamingDistributionResponse
readList :: ReadS [CreateStreamingDistributionResponse]
$creadList :: ReadS [CreateStreamingDistributionResponse]
readsPrec :: Int -> ReadS CreateStreamingDistributionResponse
$creadsPrec :: Int -> ReadS CreateStreamingDistributionResponse
Prelude.Read, Int -> CreateStreamingDistributionResponse -> ShowS
[CreateStreamingDistributionResponse] -> ShowS
CreateStreamingDistributionResponse -> String
(Int -> CreateStreamingDistributionResponse -> ShowS)
-> (CreateStreamingDistributionResponse -> String)
-> ([CreateStreamingDistributionResponse] -> ShowS)
-> Show CreateStreamingDistributionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateStreamingDistributionResponse] -> ShowS
$cshowList :: [CreateStreamingDistributionResponse] -> ShowS
show :: CreateStreamingDistributionResponse -> String
$cshow :: CreateStreamingDistributionResponse -> String
showsPrec :: Int -> CreateStreamingDistributionResponse -> ShowS
$cshowsPrec :: Int -> CreateStreamingDistributionResponse -> ShowS
Prelude.Show, (forall x.
CreateStreamingDistributionResponse
-> Rep CreateStreamingDistributionResponse x)
-> (forall x.
Rep CreateStreamingDistributionResponse x
-> CreateStreamingDistributionResponse)
-> Generic CreateStreamingDistributionResponse
forall x.
Rep CreateStreamingDistributionResponse x
-> CreateStreamingDistributionResponse
forall x.
CreateStreamingDistributionResponse
-> Rep CreateStreamingDistributionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateStreamingDistributionResponse x
-> CreateStreamingDistributionResponse
$cfrom :: forall x.
CreateStreamingDistributionResponse
-> Rep CreateStreamingDistributionResponse x
Prelude.Generic)
newCreateStreamingDistributionResponse ::
Prelude.Int ->
CreateStreamingDistributionResponse
newCreateStreamingDistributionResponse :: Int -> CreateStreamingDistributionResponse
newCreateStreamingDistributionResponse Int
pHttpStatus_ =
CreateStreamingDistributionResponse' :: Maybe Text
-> Maybe Text
-> Maybe StreamingDistribution
-> Int
-> CreateStreamingDistributionResponse
CreateStreamingDistributionResponse'
{ $sel:eTag:CreateStreamingDistributionResponse' :: Maybe Text
eTag =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:location:CreateStreamingDistributionResponse' :: Maybe Text
location = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:streamingDistribution:CreateStreamingDistributionResponse' :: Maybe StreamingDistribution
streamingDistribution =
Maybe StreamingDistribution
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateStreamingDistributionResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createStreamingDistributionResponse_eTag :: Lens.Lens' CreateStreamingDistributionResponse (Prelude.Maybe Prelude.Text)
createStreamingDistributionResponse_eTag :: (Maybe Text -> f (Maybe Text))
-> CreateStreamingDistributionResponse
-> f CreateStreamingDistributionResponse
createStreamingDistributionResponse_eTag = (CreateStreamingDistributionResponse -> Maybe Text)
-> (CreateStreamingDistributionResponse
-> Maybe Text -> CreateStreamingDistributionResponse)
-> Lens
CreateStreamingDistributionResponse
CreateStreamingDistributionResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStreamingDistributionResponse' {Maybe Text
eTag :: Maybe Text
$sel:eTag:CreateStreamingDistributionResponse' :: CreateStreamingDistributionResponse -> Maybe Text
eTag} -> Maybe Text
eTag) (\s :: CreateStreamingDistributionResponse
s@CreateStreamingDistributionResponse' {} Maybe Text
a -> CreateStreamingDistributionResponse
s {$sel:eTag:CreateStreamingDistributionResponse' :: Maybe Text
eTag = Maybe Text
a} :: CreateStreamingDistributionResponse)
createStreamingDistributionResponse_location :: Lens.Lens' CreateStreamingDistributionResponse (Prelude.Maybe Prelude.Text)
createStreamingDistributionResponse_location :: (Maybe Text -> f (Maybe Text))
-> CreateStreamingDistributionResponse
-> f CreateStreamingDistributionResponse
createStreamingDistributionResponse_location = (CreateStreamingDistributionResponse -> Maybe Text)
-> (CreateStreamingDistributionResponse
-> Maybe Text -> CreateStreamingDistributionResponse)
-> Lens
CreateStreamingDistributionResponse
CreateStreamingDistributionResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStreamingDistributionResponse' {Maybe Text
location :: Maybe Text
$sel:location:CreateStreamingDistributionResponse' :: CreateStreamingDistributionResponse -> Maybe Text
location} -> Maybe Text
location) (\s :: CreateStreamingDistributionResponse
s@CreateStreamingDistributionResponse' {} Maybe Text
a -> CreateStreamingDistributionResponse
s {$sel:location:CreateStreamingDistributionResponse' :: Maybe Text
location = Maybe Text
a} :: CreateStreamingDistributionResponse)
createStreamingDistributionResponse_streamingDistribution :: Lens.Lens' CreateStreamingDistributionResponse (Prelude.Maybe StreamingDistribution)
createStreamingDistributionResponse_streamingDistribution :: (Maybe StreamingDistribution -> f (Maybe StreamingDistribution))
-> CreateStreamingDistributionResponse
-> f CreateStreamingDistributionResponse
createStreamingDistributionResponse_streamingDistribution = (CreateStreamingDistributionResponse
-> Maybe StreamingDistribution)
-> (CreateStreamingDistributionResponse
-> Maybe StreamingDistribution
-> CreateStreamingDistributionResponse)
-> Lens
CreateStreamingDistributionResponse
CreateStreamingDistributionResponse
(Maybe StreamingDistribution)
(Maybe StreamingDistribution)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStreamingDistributionResponse' {Maybe StreamingDistribution
streamingDistribution :: Maybe StreamingDistribution
$sel:streamingDistribution:CreateStreamingDistributionResponse' :: CreateStreamingDistributionResponse -> Maybe StreamingDistribution
streamingDistribution} -> Maybe StreamingDistribution
streamingDistribution) (\s :: CreateStreamingDistributionResponse
s@CreateStreamingDistributionResponse' {} Maybe StreamingDistribution
a -> CreateStreamingDistributionResponse
s {$sel:streamingDistribution:CreateStreamingDistributionResponse' :: Maybe StreamingDistribution
streamingDistribution = Maybe StreamingDistribution
a} :: CreateStreamingDistributionResponse)
createStreamingDistributionResponse_httpStatus :: Lens.Lens' CreateStreamingDistributionResponse Prelude.Int
createStreamingDistributionResponse_httpStatus :: (Int -> f Int)
-> CreateStreamingDistributionResponse
-> f CreateStreamingDistributionResponse
createStreamingDistributionResponse_httpStatus = (CreateStreamingDistributionResponse -> Int)
-> (CreateStreamingDistributionResponse
-> Int -> CreateStreamingDistributionResponse)
-> Lens
CreateStreamingDistributionResponse
CreateStreamingDistributionResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStreamingDistributionResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateStreamingDistributionResponse' :: CreateStreamingDistributionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateStreamingDistributionResponse
s@CreateStreamingDistributionResponse' {} Int
a -> CreateStreamingDistributionResponse
s {$sel:httpStatus:CreateStreamingDistributionResponse' :: Int
httpStatus = Int
a} :: CreateStreamingDistributionResponse)
instance
Prelude.NFData
CreateStreamingDistributionResponse