{-# 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.NetworkManager.CreateSite
(
CreateSite (..),
newCreateSite,
createSite_description,
createSite_location,
createSite_tags,
createSite_globalNetworkId,
CreateSiteResponse (..),
newCreateSiteResponse,
createSiteResponse_site,
createSiteResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.NetworkManager.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data CreateSite = CreateSite'
{
CreateSite -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
CreateSite -> Maybe (Sensitive Location)
location :: Prelude.Maybe (Data.Sensitive Location),
CreateSite -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
CreateSite -> Text
globalNetworkId :: Prelude.Text
}
deriving (CreateSite -> CreateSite -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateSite -> CreateSite -> Bool
$c/= :: CreateSite -> CreateSite -> Bool
== :: CreateSite -> CreateSite -> Bool
$c== :: CreateSite -> CreateSite -> Bool
Prelude.Eq, Int -> CreateSite -> ShowS
[CreateSite] -> ShowS
CreateSite -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateSite] -> ShowS
$cshowList :: [CreateSite] -> ShowS
show :: CreateSite -> String
$cshow :: CreateSite -> String
showsPrec :: Int -> CreateSite -> ShowS
$cshowsPrec :: Int -> CreateSite -> ShowS
Prelude.Show, forall x. Rep CreateSite x -> CreateSite
forall x. CreateSite -> Rep CreateSite x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateSite x -> CreateSite
$cfrom :: forall x. CreateSite -> Rep CreateSite x
Prelude.Generic)
newCreateSite ::
Prelude.Text ->
CreateSite
newCreateSite :: Text -> CreateSite
newCreateSite Text
pGlobalNetworkId_ =
CreateSite'
{ $sel:description:CreateSite' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
$sel:location:CreateSite' :: Maybe (Sensitive Location)
location = forall a. Maybe a
Prelude.Nothing,
$sel:tags:CreateSite' :: Maybe [Tag]
tags = forall a. Maybe a
Prelude.Nothing,
$sel:globalNetworkId:CreateSite' :: Text
globalNetworkId = Text
pGlobalNetworkId_
}
createSite_description :: Lens.Lens' CreateSite (Prelude.Maybe Prelude.Text)
createSite_description :: Lens' CreateSite (Maybe Text)
createSite_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSite' {Maybe Text
description :: Maybe Text
$sel:description:CreateSite' :: CreateSite -> Maybe Text
description} -> Maybe Text
description) (\s :: CreateSite
s@CreateSite' {} Maybe Text
a -> CreateSite
s {$sel:description:CreateSite' :: Maybe Text
description = Maybe Text
a} :: CreateSite)
createSite_location :: Lens.Lens' CreateSite (Prelude.Maybe Location)
createSite_location :: Lens' CreateSite (Maybe Location)
createSite_location = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSite' {Maybe (Sensitive Location)
location :: Maybe (Sensitive Location)
$sel:location:CreateSite' :: CreateSite -> Maybe (Sensitive Location)
location} -> Maybe (Sensitive Location)
location) (\s :: CreateSite
s@CreateSite' {} Maybe (Sensitive Location)
a -> CreateSite
s {$sel:location:CreateSite' :: Maybe (Sensitive Location)
location = Maybe (Sensitive Location)
a} :: CreateSite) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall a. Iso' (Sensitive a) a
Data._Sensitive
createSite_tags :: Lens.Lens' CreateSite (Prelude.Maybe [Tag])
createSite_tags :: Lens' CreateSite (Maybe [Tag])
createSite_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSite' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateSite' :: CreateSite -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateSite
s@CreateSite' {} Maybe [Tag]
a -> CreateSite
s {$sel:tags:CreateSite' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateSite) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createSite_globalNetworkId :: Lens.Lens' CreateSite Prelude.Text
createSite_globalNetworkId :: Lens' CreateSite Text
createSite_globalNetworkId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSite' {Text
globalNetworkId :: Text
$sel:globalNetworkId:CreateSite' :: CreateSite -> Text
globalNetworkId} -> Text
globalNetworkId) (\s :: CreateSite
s@CreateSite' {} Text
a -> CreateSite
s {$sel:globalNetworkId:CreateSite' :: Text
globalNetworkId = Text
a} :: CreateSite)
instance Core.AWSRequest CreateSite where
type AWSResponse CreateSite = CreateSiteResponse
request :: (Service -> Service) -> CreateSite -> Request CreateSite
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateSite
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateSite)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Site -> Int -> CreateSiteResponse
CreateSiteResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Site")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable CreateSite where
hashWithSalt :: Int -> CreateSite -> Int
hashWithSalt Int
_salt CreateSite' {Maybe [Tag]
Maybe Text
Maybe (Sensitive Location)
Text
globalNetworkId :: Text
tags :: Maybe [Tag]
location :: Maybe (Sensitive Location)
description :: Maybe Text
$sel:globalNetworkId:CreateSite' :: CreateSite -> Text
$sel:tags:CreateSite' :: CreateSite -> Maybe [Tag]
$sel:location:CreateSite' :: CreateSite -> Maybe (Sensitive Location)
$sel:description:CreateSite' :: CreateSite -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Location)
location
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Tag]
tags
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
globalNetworkId
instance Prelude.NFData CreateSite where
rnf :: CreateSite -> ()
rnf CreateSite' {Maybe [Tag]
Maybe Text
Maybe (Sensitive Location)
Text
globalNetworkId :: Text
tags :: Maybe [Tag]
location :: Maybe (Sensitive Location)
description :: Maybe Text
$sel:globalNetworkId:CreateSite' :: CreateSite -> Text
$sel:tags:CreateSite' :: CreateSite -> Maybe [Tag]
$sel:location:CreateSite' :: CreateSite -> Maybe (Sensitive Location)
$sel:description:CreateSite' :: CreateSite -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Location)
location
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Tag]
tags
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
globalNetworkId
instance Data.ToHeaders CreateSite where
toHeaders :: CreateSite -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON CreateSite where
toJSON :: CreateSite -> Value
toJSON CreateSite' {Maybe [Tag]
Maybe Text
Maybe (Sensitive Location)
Text
globalNetworkId :: Text
tags :: Maybe [Tag]
location :: Maybe (Sensitive Location)
description :: Maybe Text
$sel:globalNetworkId:CreateSite' :: CreateSite -> Text
$sel:tags:CreateSite' :: CreateSite -> Maybe [Tag]
$sel:location:CreateSite' :: CreateSite -> Maybe (Sensitive Location)
$sel:description:CreateSite' :: CreateSite -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"Description" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
description,
(Key
"Location" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive Location)
location,
(Key
"Tags" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags
]
)
instance Data.ToPath CreateSite where
toPath :: CreateSite -> ByteString
toPath CreateSite' {Maybe [Tag]
Maybe Text
Maybe (Sensitive Location)
Text
globalNetworkId :: Text
tags :: Maybe [Tag]
location :: Maybe (Sensitive Location)
description :: Maybe Text
$sel:globalNetworkId:CreateSite' :: CreateSite -> Text
$sel:tags:CreateSite' :: CreateSite -> Maybe [Tag]
$sel:location:CreateSite' :: CreateSite -> Maybe (Sensitive Location)
$sel:description:CreateSite' :: CreateSite -> Maybe Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/global-networks/",
forall a. ToByteString a => a -> ByteString
Data.toBS Text
globalNetworkId,
ByteString
"/sites"
]
instance Data.ToQuery CreateSite where
toQuery :: CreateSite -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data CreateSiteResponse = CreateSiteResponse'
{
CreateSiteResponse -> Maybe Site
site :: Prelude.Maybe Site,
CreateSiteResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateSiteResponse -> CreateSiteResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateSiteResponse -> CreateSiteResponse -> Bool
$c/= :: CreateSiteResponse -> CreateSiteResponse -> Bool
== :: CreateSiteResponse -> CreateSiteResponse -> Bool
$c== :: CreateSiteResponse -> CreateSiteResponse -> Bool
Prelude.Eq, Int -> CreateSiteResponse -> ShowS
[CreateSiteResponse] -> ShowS
CreateSiteResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateSiteResponse] -> ShowS
$cshowList :: [CreateSiteResponse] -> ShowS
show :: CreateSiteResponse -> String
$cshow :: CreateSiteResponse -> String
showsPrec :: Int -> CreateSiteResponse -> ShowS
$cshowsPrec :: Int -> CreateSiteResponse -> ShowS
Prelude.Show, forall x. Rep CreateSiteResponse x -> CreateSiteResponse
forall x. CreateSiteResponse -> Rep CreateSiteResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateSiteResponse x -> CreateSiteResponse
$cfrom :: forall x. CreateSiteResponse -> Rep CreateSiteResponse x
Prelude.Generic)
newCreateSiteResponse ::
Prelude.Int ->
CreateSiteResponse
newCreateSiteResponse :: Int -> CreateSiteResponse
newCreateSiteResponse Int
pHttpStatus_ =
CreateSiteResponse'
{ $sel:site:CreateSiteResponse' :: Maybe Site
site = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateSiteResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createSiteResponse_site :: Lens.Lens' CreateSiteResponse (Prelude.Maybe Site)
createSiteResponse_site :: Lens' CreateSiteResponse (Maybe Site)
createSiteResponse_site = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSiteResponse' {Maybe Site
site :: Maybe Site
$sel:site:CreateSiteResponse' :: CreateSiteResponse -> Maybe Site
site} -> Maybe Site
site) (\s :: CreateSiteResponse
s@CreateSiteResponse' {} Maybe Site
a -> CreateSiteResponse
s {$sel:site:CreateSiteResponse' :: Maybe Site
site = Maybe Site
a} :: CreateSiteResponse)
createSiteResponse_httpStatus :: Lens.Lens' CreateSiteResponse Prelude.Int
createSiteResponse_httpStatus :: Lens' CreateSiteResponse Int
createSiteResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSiteResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateSiteResponse' :: CreateSiteResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateSiteResponse
s@CreateSiteResponse' {} Int
a -> CreateSiteResponse
s {$sel:httpStatus:CreateSiteResponse' :: Int
httpStatus = Int
a} :: CreateSiteResponse)
instance Prelude.NFData CreateSiteResponse where
rnf :: CreateSiteResponse -> ()
rnf CreateSiteResponse' {Int
Maybe Site
httpStatus :: Int
site :: Maybe Site
$sel:httpStatus:CreateSiteResponse' :: CreateSiteResponse -> Int
$sel:site:CreateSiteResponse' :: CreateSiteResponse -> Maybe Site
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Site
site
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus