{-# 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.CreateDistributionWithTags
(
CreateDistributionWithTags (..),
newCreateDistributionWithTags,
createDistributionWithTags_distributionConfigWithTags,
CreateDistributionWithTagsResponse (..),
newCreateDistributionWithTagsResponse,
createDistributionWithTagsResponse_eTag,
createDistributionWithTagsResponse_distribution,
createDistributionWithTagsResponse_location,
createDistributionWithTagsResponse_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 CreateDistributionWithTags = CreateDistributionWithTags'
{
CreateDistributionWithTags -> DistributionConfigWithTags
distributionConfigWithTags :: DistributionConfigWithTags
}
deriving (CreateDistributionWithTags -> CreateDistributionWithTags -> Bool
(CreateDistributionWithTags -> CreateDistributionWithTags -> Bool)
-> (CreateDistributionWithTags
-> CreateDistributionWithTags -> Bool)
-> Eq CreateDistributionWithTags
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDistributionWithTags -> CreateDistributionWithTags -> Bool
$c/= :: CreateDistributionWithTags -> CreateDistributionWithTags -> Bool
== :: CreateDistributionWithTags -> CreateDistributionWithTags -> Bool
$c== :: CreateDistributionWithTags -> CreateDistributionWithTags -> Bool
Prelude.Eq, Int -> CreateDistributionWithTags -> ShowS
[CreateDistributionWithTags] -> ShowS
CreateDistributionWithTags -> String
(Int -> CreateDistributionWithTags -> ShowS)
-> (CreateDistributionWithTags -> String)
-> ([CreateDistributionWithTags] -> ShowS)
-> Show CreateDistributionWithTags
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDistributionWithTags] -> ShowS
$cshowList :: [CreateDistributionWithTags] -> ShowS
show :: CreateDistributionWithTags -> String
$cshow :: CreateDistributionWithTags -> String
showsPrec :: Int -> CreateDistributionWithTags -> ShowS
$cshowsPrec :: Int -> CreateDistributionWithTags -> ShowS
Prelude.Show, (forall x.
CreateDistributionWithTags -> Rep CreateDistributionWithTags x)
-> (forall x.
Rep CreateDistributionWithTags x -> CreateDistributionWithTags)
-> Generic CreateDistributionWithTags
forall x.
Rep CreateDistributionWithTags x -> CreateDistributionWithTags
forall x.
CreateDistributionWithTags -> Rep CreateDistributionWithTags x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateDistributionWithTags x -> CreateDistributionWithTags
$cfrom :: forall x.
CreateDistributionWithTags -> Rep CreateDistributionWithTags x
Prelude.Generic)
newCreateDistributionWithTags ::
DistributionConfigWithTags ->
CreateDistributionWithTags
newCreateDistributionWithTags :: DistributionConfigWithTags -> CreateDistributionWithTags
newCreateDistributionWithTags
DistributionConfigWithTags
pDistributionConfigWithTags_ =
CreateDistributionWithTags' :: DistributionConfigWithTags -> CreateDistributionWithTags
CreateDistributionWithTags'
{ $sel:distributionConfigWithTags:CreateDistributionWithTags' :: DistributionConfigWithTags
distributionConfigWithTags =
DistributionConfigWithTags
pDistributionConfigWithTags_
}
createDistributionWithTags_distributionConfigWithTags :: Lens.Lens' CreateDistributionWithTags DistributionConfigWithTags
createDistributionWithTags_distributionConfigWithTags :: (DistributionConfigWithTags -> f DistributionConfigWithTags)
-> CreateDistributionWithTags -> f CreateDistributionWithTags
createDistributionWithTags_distributionConfigWithTags = (CreateDistributionWithTags -> DistributionConfigWithTags)
-> (CreateDistributionWithTags
-> DistributionConfigWithTags -> CreateDistributionWithTags)
-> Lens
CreateDistributionWithTags
CreateDistributionWithTags
DistributionConfigWithTags
DistributionConfigWithTags
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDistributionWithTags' {DistributionConfigWithTags
distributionConfigWithTags :: DistributionConfigWithTags
$sel:distributionConfigWithTags:CreateDistributionWithTags' :: CreateDistributionWithTags -> DistributionConfigWithTags
distributionConfigWithTags} -> DistributionConfigWithTags
distributionConfigWithTags) (\s :: CreateDistributionWithTags
s@CreateDistributionWithTags' {} DistributionConfigWithTags
a -> CreateDistributionWithTags
s {$sel:distributionConfigWithTags:CreateDistributionWithTags' :: DistributionConfigWithTags
distributionConfigWithTags = DistributionConfigWithTags
a} :: CreateDistributionWithTags)
instance Core.AWSRequest CreateDistributionWithTags where
type
AWSResponse CreateDistributionWithTags =
CreateDistributionWithTagsResponse
request :: CreateDistributionWithTags -> Request CreateDistributionWithTags
request = Service
-> CreateDistributionWithTags -> Request CreateDistributionWithTags
forall a. (ToRequest a, ToElement a) => Service -> a -> Request a
Request.postXML Service
defaultService
response :: Logger
-> Service
-> Proxy CreateDistributionWithTags
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateDistributionWithTags)))
response =
(Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse CreateDistributionWithTags))
-> Logger
-> Service
-> Proxy CreateDistributionWithTags
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateDistributionWithTags)))
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 Distribution
-> Maybe Text
-> Int
-> CreateDistributionWithTagsResponse
CreateDistributionWithTagsResponse'
(Maybe Text
-> Maybe Distribution
-> Maybe Text
-> Int
-> CreateDistributionWithTagsResponse)
-> Either String (Maybe Text)
-> Either
String
(Maybe Distribution
-> Maybe Text -> Int -> CreateDistributionWithTagsResponse)
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 Distribution
-> Maybe Text -> Int -> CreateDistributionWithTagsResponse)
-> Either String (Maybe Distribution)
-> Either
String (Maybe Text -> Int -> CreateDistributionWithTagsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node] -> Either String (Maybe Distribution)
forall a. FromXML a => [Node] -> Either String a
Core.parseXML [Node]
x)
Either
String (Maybe Text -> Int -> CreateDistributionWithTagsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateDistributionWithTagsResponse)
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 (Int -> CreateDistributionWithTagsResponse)
-> Either String Int
-> Either String CreateDistributionWithTagsResponse
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 CreateDistributionWithTags
instance Prelude.NFData CreateDistributionWithTags
instance Core.ToElement CreateDistributionWithTags where
toElement :: CreateDistributionWithTags -> Element
toElement CreateDistributionWithTags' {DistributionConfigWithTags
distributionConfigWithTags :: DistributionConfigWithTags
$sel:distributionConfigWithTags:CreateDistributionWithTags' :: CreateDistributionWithTags -> DistributionConfigWithTags
..} =
Name -> DistributionConfigWithTags -> Element
forall a. ToXML a => Name -> a -> Element
Core.mkElement
Name
"{http://cloudfront.amazonaws.com/doc/2020-05-31/}DistributionConfigWithTags"
DistributionConfigWithTags
distributionConfigWithTags
instance Core.ToHeaders CreateDistributionWithTags where
toHeaders :: CreateDistributionWithTags -> ResponseHeaders
toHeaders = ResponseHeaders -> CreateDistributionWithTags -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath CreateDistributionWithTags where
toPath :: CreateDistributionWithTags -> ByteString
toPath = ByteString -> CreateDistributionWithTags -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/2020-05-31/distribution"
instance Core.ToQuery CreateDistributionWithTags where
toQuery :: CreateDistributionWithTags -> QueryString
toQuery =
QueryString -> CreateDistributionWithTags -> QueryString
forall a b. a -> b -> a
Prelude.const ([QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat [QueryString
"WithTags"])
data CreateDistributionWithTagsResponse = CreateDistributionWithTagsResponse'
{
CreateDistributionWithTagsResponse -> Maybe Text
eTag :: Prelude.Maybe Prelude.Text,
CreateDistributionWithTagsResponse -> Maybe Distribution
distribution :: Prelude.Maybe Distribution,
CreateDistributionWithTagsResponse -> Maybe Text
location :: Prelude.Maybe Prelude.Text,
CreateDistributionWithTagsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateDistributionWithTagsResponse
-> CreateDistributionWithTagsResponse -> Bool
(CreateDistributionWithTagsResponse
-> CreateDistributionWithTagsResponse -> Bool)
-> (CreateDistributionWithTagsResponse
-> CreateDistributionWithTagsResponse -> Bool)
-> Eq CreateDistributionWithTagsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDistributionWithTagsResponse
-> CreateDistributionWithTagsResponse -> Bool
$c/= :: CreateDistributionWithTagsResponse
-> CreateDistributionWithTagsResponse -> Bool
== :: CreateDistributionWithTagsResponse
-> CreateDistributionWithTagsResponse -> Bool
$c== :: CreateDistributionWithTagsResponse
-> CreateDistributionWithTagsResponse -> Bool
Prelude.Eq, Int -> CreateDistributionWithTagsResponse -> ShowS
[CreateDistributionWithTagsResponse] -> ShowS
CreateDistributionWithTagsResponse -> String
(Int -> CreateDistributionWithTagsResponse -> ShowS)
-> (CreateDistributionWithTagsResponse -> String)
-> ([CreateDistributionWithTagsResponse] -> ShowS)
-> Show CreateDistributionWithTagsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDistributionWithTagsResponse] -> ShowS
$cshowList :: [CreateDistributionWithTagsResponse] -> ShowS
show :: CreateDistributionWithTagsResponse -> String
$cshow :: CreateDistributionWithTagsResponse -> String
showsPrec :: Int -> CreateDistributionWithTagsResponse -> ShowS
$cshowsPrec :: Int -> CreateDistributionWithTagsResponse -> ShowS
Prelude.Show, (forall x.
CreateDistributionWithTagsResponse
-> Rep CreateDistributionWithTagsResponse x)
-> (forall x.
Rep CreateDistributionWithTagsResponse x
-> CreateDistributionWithTagsResponse)
-> Generic CreateDistributionWithTagsResponse
forall x.
Rep CreateDistributionWithTagsResponse x
-> CreateDistributionWithTagsResponse
forall x.
CreateDistributionWithTagsResponse
-> Rep CreateDistributionWithTagsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateDistributionWithTagsResponse x
-> CreateDistributionWithTagsResponse
$cfrom :: forall x.
CreateDistributionWithTagsResponse
-> Rep CreateDistributionWithTagsResponse x
Prelude.Generic)
newCreateDistributionWithTagsResponse ::
Prelude.Int ->
CreateDistributionWithTagsResponse
newCreateDistributionWithTagsResponse :: Int -> CreateDistributionWithTagsResponse
newCreateDistributionWithTagsResponse Int
pHttpStatus_ =
CreateDistributionWithTagsResponse' :: Maybe Text
-> Maybe Distribution
-> Maybe Text
-> Int
-> CreateDistributionWithTagsResponse
CreateDistributionWithTagsResponse'
{ $sel:eTag:CreateDistributionWithTagsResponse' :: Maybe Text
eTag =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:distribution:CreateDistributionWithTagsResponse' :: Maybe Distribution
distribution = Maybe Distribution
forall a. Maybe a
Prelude.Nothing,
$sel:location:CreateDistributionWithTagsResponse' :: Maybe Text
location = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateDistributionWithTagsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createDistributionWithTagsResponse_eTag :: Lens.Lens' CreateDistributionWithTagsResponse (Prelude.Maybe Prelude.Text)
createDistributionWithTagsResponse_eTag :: (Maybe Text -> f (Maybe Text))
-> CreateDistributionWithTagsResponse
-> f CreateDistributionWithTagsResponse
createDistributionWithTagsResponse_eTag = (CreateDistributionWithTagsResponse -> Maybe Text)
-> (CreateDistributionWithTagsResponse
-> Maybe Text -> CreateDistributionWithTagsResponse)
-> Lens
CreateDistributionWithTagsResponse
CreateDistributionWithTagsResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDistributionWithTagsResponse' {Maybe Text
eTag :: Maybe Text
$sel:eTag:CreateDistributionWithTagsResponse' :: CreateDistributionWithTagsResponse -> Maybe Text
eTag} -> Maybe Text
eTag) (\s :: CreateDistributionWithTagsResponse
s@CreateDistributionWithTagsResponse' {} Maybe Text
a -> CreateDistributionWithTagsResponse
s {$sel:eTag:CreateDistributionWithTagsResponse' :: Maybe Text
eTag = Maybe Text
a} :: CreateDistributionWithTagsResponse)
createDistributionWithTagsResponse_distribution :: Lens.Lens' CreateDistributionWithTagsResponse (Prelude.Maybe Distribution)
createDistributionWithTagsResponse_distribution :: (Maybe Distribution -> f (Maybe Distribution))
-> CreateDistributionWithTagsResponse
-> f CreateDistributionWithTagsResponse
createDistributionWithTagsResponse_distribution = (CreateDistributionWithTagsResponse -> Maybe Distribution)
-> (CreateDistributionWithTagsResponse
-> Maybe Distribution -> CreateDistributionWithTagsResponse)
-> Lens
CreateDistributionWithTagsResponse
CreateDistributionWithTagsResponse
(Maybe Distribution)
(Maybe Distribution)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDistributionWithTagsResponse' {Maybe Distribution
distribution :: Maybe Distribution
$sel:distribution:CreateDistributionWithTagsResponse' :: CreateDistributionWithTagsResponse -> Maybe Distribution
distribution} -> Maybe Distribution
distribution) (\s :: CreateDistributionWithTagsResponse
s@CreateDistributionWithTagsResponse' {} Maybe Distribution
a -> CreateDistributionWithTagsResponse
s {$sel:distribution:CreateDistributionWithTagsResponse' :: Maybe Distribution
distribution = Maybe Distribution
a} :: CreateDistributionWithTagsResponse)
createDistributionWithTagsResponse_location :: Lens.Lens' CreateDistributionWithTagsResponse (Prelude.Maybe Prelude.Text)
createDistributionWithTagsResponse_location :: (Maybe Text -> f (Maybe Text))
-> CreateDistributionWithTagsResponse
-> f CreateDistributionWithTagsResponse
createDistributionWithTagsResponse_location = (CreateDistributionWithTagsResponse -> Maybe Text)
-> (CreateDistributionWithTagsResponse
-> Maybe Text -> CreateDistributionWithTagsResponse)
-> Lens
CreateDistributionWithTagsResponse
CreateDistributionWithTagsResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDistributionWithTagsResponse' {Maybe Text
location :: Maybe Text
$sel:location:CreateDistributionWithTagsResponse' :: CreateDistributionWithTagsResponse -> Maybe Text
location} -> Maybe Text
location) (\s :: CreateDistributionWithTagsResponse
s@CreateDistributionWithTagsResponse' {} Maybe Text
a -> CreateDistributionWithTagsResponse
s {$sel:location:CreateDistributionWithTagsResponse' :: Maybe Text
location = Maybe Text
a} :: CreateDistributionWithTagsResponse)
createDistributionWithTagsResponse_httpStatus :: Lens.Lens' CreateDistributionWithTagsResponse Prelude.Int
createDistributionWithTagsResponse_httpStatus :: (Int -> f Int)
-> CreateDistributionWithTagsResponse
-> f CreateDistributionWithTagsResponse
createDistributionWithTagsResponse_httpStatus = (CreateDistributionWithTagsResponse -> Int)
-> (CreateDistributionWithTagsResponse
-> Int -> CreateDistributionWithTagsResponse)
-> Lens
CreateDistributionWithTagsResponse
CreateDistributionWithTagsResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDistributionWithTagsResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateDistributionWithTagsResponse' :: CreateDistributionWithTagsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateDistributionWithTagsResponse
s@CreateDistributionWithTagsResponse' {} Int
a -> CreateDistributionWithTagsResponse
s {$sel:httpStatus:CreateDistributionWithTagsResponse' :: Int
httpStatus = Int
a} :: CreateDistributionWithTagsResponse)
instance
Prelude.NFData
CreateDistributionWithTagsResponse