{-# 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.OpsWorks.GetHostnameSuggestion
(
GetHostnameSuggestion (..),
newGetHostnameSuggestion,
getHostnameSuggestion_layerId,
GetHostnameSuggestionResponse (..),
newGetHostnameSuggestionResponse,
getHostnameSuggestionResponse_hostname,
getHostnameSuggestionResponse_layerId,
getHostnameSuggestionResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.OpsWorks.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetHostnameSuggestion = GetHostnameSuggestion'
{
GetHostnameSuggestion -> Text
layerId :: Prelude.Text
}
deriving (GetHostnameSuggestion -> GetHostnameSuggestion -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetHostnameSuggestion -> GetHostnameSuggestion -> Bool
$c/= :: GetHostnameSuggestion -> GetHostnameSuggestion -> Bool
== :: GetHostnameSuggestion -> GetHostnameSuggestion -> Bool
$c== :: GetHostnameSuggestion -> GetHostnameSuggestion -> Bool
Prelude.Eq, ReadPrec [GetHostnameSuggestion]
ReadPrec GetHostnameSuggestion
Int -> ReadS GetHostnameSuggestion
ReadS [GetHostnameSuggestion]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetHostnameSuggestion]
$creadListPrec :: ReadPrec [GetHostnameSuggestion]
readPrec :: ReadPrec GetHostnameSuggestion
$creadPrec :: ReadPrec GetHostnameSuggestion
readList :: ReadS [GetHostnameSuggestion]
$creadList :: ReadS [GetHostnameSuggestion]
readsPrec :: Int -> ReadS GetHostnameSuggestion
$creadsPrec :: Int -> ReadS GetHostnameSuggestion
Prelude.Read, Int -> GetHostnameSuggestion -> ShowS
[GetHostnameSuggestion] -> ShowS
GetHostnameSuggestion -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetHostnameSuggestion] -> ShowS
$cshowList :: [GetHostnameSuggestion] -> ShowS
show :: GetHostnameSuggestion -> String
$cshow :: GetHostnameSuggestion -> String
showsPrec :: Int -> GetHostnameSuggestion -> ShowS
$cshowsPrec :: Int -> GetHostnameSuggestion -> ShowS
Prelude.Show, forall x. Rep GetHostnameSuggestion x -> GetHostnameSuggestion
forall x. GetHostnameSuggestion -> Rep GetHostnameSuggestion x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetHostnameSuggestion x -> GetHostnameSuggestion
$cfrom :: forall x. GetHostnameSuggestion -> Rep GetHostnameSuggestion x
Prelude.Generic)
newGetHostnameSuggestion ::
Prelude.Text ->
GetHostnameSuggestion
newGetHostnameSuggestion :: Text -> GetHostnameSuggestion
newGetHostnameSuggestion Text
pLayerId_ =
GetHostnameSuggestion' {$sel:layerId:GetHostnameSuggestion' :: Text
layerId = Text
pLayerId_}
getHostnameSuggestion_layerId :: Lens.Lens' GetHostnameSuggestion Prelude.Text
getHostnameSuggestion_layerId :: Lens' GetHostnameSuggestion Text
getHostnameSuggestion_layerId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetHostnameSuggestion' {Text
layerId :: Text
$sel:layerId:GetHostnameSuggestion' :: GetHostnameSuggestion -> Text
layerId} -> Text
layerId) (\s :: GetHostnameSuggestion
s@GetHostnameSuggestion' {} Text
a -> GetHostnameSuggestion
s {$sel:layerId:GetHostnameSuggestion' :: Text
layerId = Text
a} :: GetHostnameSuggestion)
instance Core.AWSRequest GetHostnameSuggestion where
type
AWSResponse GetHostnameSuggestion =
GetHostnameSuggestionResponse
request :: (Service -> Service)
-> GetHostnameSuggestion -> Request GetHostnameSuggestion
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 GetHostnameSuggestion
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetHostnameSuggestion)))
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 Text -> Maybe Text -> Int -> GetHostnameSuggestionResponse
GetHostnameSuggestionResponse'
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
"Hostname")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"LayerId")
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 GetHostnameSuggestion where
hashWithSalt :: Int -> GetHostnameSuggestion -> Int
hashWithSalt Int
_salt GetHostnameSuggestion' {Text
layerId :: Text
$sel:layerId:GetHostnameSuggestion' :: GetHostnameSuggestion -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
layerId
instance Prelude.NFData GetHostnameSuggestion where
rnf :: GetHostnameSuggestion -> ()
rnf GetHostnameSuggestion' {Text
layerId :: Text
$sel:layerId:GetHostnameSuggestion' :: GetHostnameSuggestion -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
layerId
instance Data.ToHeaders GetHostnameSuggestion where
toHeaders :: GetHostnameSuggestion -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"OpsWorks_20130218.GetHostnameSuggestion" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON GetHostnameSuggestion where
toJSON :: GetHostnameSuggestion -> Value
toJSON GetHostnameSuggestion' {Text
layerId :: Text
$sel:layerId:GetHostnameSuggestion' :: GetHostnameSuggestion -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[forall a. a -> Maybe a
Prelude.Just (Key
"LayerId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
layerId)]
)
instance Data.ToPath GetHostnameSuggestion where
toPath :: GetHostnameSuggestion -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery GetHostnameSuggestion where
toQuery :: GetHostnameSuggestion -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data GetHostnameSuggestionResponse = GetHostnameSuggestionResponse'
{
GetHostnameSuggestionResponse -> Maybe Text
hostname :: Prelude.Maybe Prelude.Text,
GetHostnameSuggestionResponse -> Maybe Text
layerId :: Prelude.Maybe Prelude.Text,
GetHostnameSuggestionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetHostnameSuggestionResponse
-> GetHostnameSuggestionResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetHostnameSuggestionResponse
-> GetHostnameSuggestionResponse -> Bool
$c/= :: GetHostnameSuggestionResponse
-> GetHostnameSuggestionResponse -> Bool
== :: GetHostnameSuggestionResponse
-> GetHostnameSuggestionResponse -> Bool
$c== :: GetHostnameSuggestionResponse
-> GetHostnameSuggestionResponse -> Bool
Prelude.Eq, ReadPrec [GetHostnameSuggestionResponse]
ReadPrec GetHostnameSuggestionResponse
Int -> ReadS GetHostnameSuggestionResponse
ReadS [GetHostnameSuggestionResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetHostnameSuggestionResponse]
$creadListPrec :: ReadPrec [GetHostnameSuggestionResponse]
readPrec :: ReadPrec GetHostnameSuggestionResponse
$creadPrec :: ReadPrec GetHostnameSuggestionResponse
readList :: ReadS [GetHostnameSuggestionResponse]
$creadList :: ReadS [GetHostnameSuggestionResponse]
readsPrec :: Int -> ReadS GetHostnameSuggestionResponse
$creadsPrec :: Int -> ReadS GetHostnameSuggestionResponse
Prelude.Read, Int -> GetHostnameSuggestionResponse -> ShowS
[GetHostnameSuggestionResponse] -> ShowS
GetHostnameSuggestionResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetHostnameSuggestionResponse] -> ShowS
$cshowList :: [GetHostnameSuggestionResponse] -> ShowS
show :: GetHostnameSuggestionResponse -> String
$cshow :: GetHostnameSuggestionResponse -> String
showsPrec :: Int -> GetHostnameSuggestionResponse -> ShowS
$cshowsPrec :: Int -> GetHostnameSuggestionResponse -> ShowS
Prelude.Show, forall x.
Rep GetHostnameSuggestionResponse x
-> GetHostnameSuggestionResponse
forall x.
GetHostnameSuggestionResponse
-> Rep GetHostnameSuggestionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetHostnameSuggestionResponse x
-> GetHostnameSuggestionResponse
$cfrom :: forall x.
GetHostnameSuggestionResponse
-> Rep GetHostnameSuggestionResponse x
Prelude.Generic)
newGetHostnameSuggestionResponse ::
Prelude.Int ->
GetHostnameSuggestionResponse
newGetHostnameSuggestionResponse :: Int -> GetHostnameSuggestionResponse
newGetHostnameSuggestionResponse Int
pHttpStatus_ =
GetHostnameSuggestionResponse'
{ $sel:hostname:GetHostnameSuggestionResponse' :: Maybe Text
hostname =
forall a. Maybe a
Prelude.Nothing,
$sel:layerId:GetHostnameSuggestionResponse' :: Maybe Text
layerId = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetHostnameSuggestionResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getHostnameSuggestionResponse_hostname :: Lens.Lens' GetHostnameSuggestionResponse (Prelude.Maybe Prelude.Text)
getHostnameSuggestionResponse_hostname :: Lens' GetHostnameSuggestionResponse (Maybe Text)
getHostnameSuggestionResponse_hostname = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetHostnameSuggestionResponse' {Maybe Text
hostname :: Maybe Text
$sel:hostname:GetHostnameSuggestionResponse' :: GetHostnameSuggestionResponse -> Maybe Text
hostname} -> Maybe Text
hostname) (\s :: GetHostnameSuggestionResponse
s@GetHostnameSuggestionResponse' {} Maybe Text
a -> GetHostnameSuggestionResponse
s {$sel:hostname:GetHostnameSuggestionResponse' :: Maybe Text
hostname = Maybe Text
a} :: GetHostnameSuggestionResponse)
getHostnameSuggestionResponse_layerId :: Lens.Lens' GetHostnameSuggestionResponse (Prelude.Maybe Prelude.Text)
getHostnameSuggestionResponse_layerId :: Lens' GetHostnameSuggestionResponse (Maybe Text)
getHostnameSuggestionResponse_layerId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetHostnameSuggestionResponse' {Maybe Text
layerId :: Maybe Text
$sel:layerId:GetHostnameSuggestionResponse' :: GetHostnameSuggestionResponse -> Maybe Text
layerId} -> Maybe Text
layerId) (\s :: GetHostnameSuggestionResponse
s@GetHostnameSuggestionResponse' {} Maybe Text
a -> GetHostnameSuggestionResponse
s {$sel:layerId:GetHostnameSuggestionResponse' :: Maybe Text
layerId = Maybe Text
a} :: GetHostnameSuggestionResponse)
getHostnameSuggestionResponse_httpStatus :: Lens.Lens' GetHostnameSuggestionResponse Prelude.Int
getHostnameSuggestionResponse_httpStatus :: Lens' GetHostnameSuggestionResponse Int
getHostnameSuggestionResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetHostnameSuggestionResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetHostnameSuggestionResponse' :: GetHostnameSuggestionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetHostnameSuggestionResponse
s@GetHostnameSuggestionResponse' {} Int
a -> GetHostnameSuggestionResponse
s {$sel:httpStatus:GetHostnameSuggestionResponse' :: Int
httpStatus = Int
a} :: GetHostnameSuggestionResponse)
instance Prelude.NFData GetHostnameSuggestionResponse where
rnf :: GetHostnameSuggestionResponse -> ()
rnf GetHostnameSuggestionResponse' {Int
Maybe Text
httpStatus :: Int
layerId :: Maybe Text
hostname :: Maybe Text
$sel:httpStatus:GetHostnameSuggestionResponse' :: GetHostnameSuggestionResponse -> Int
$sel:layerId:GetHostnameSuggestionResponse' :: GetHostnameSuggestionResponse -> Maybe Text
$sel:hostname:GetHostnameSuggestionResponse' :: GetHostnameSuggestionResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
hostname
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
layerId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus