{-# 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.Lens as Lens
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
(GetHostnameSuggestion -> GetHostnameSuggestion -> Bool)
-> (GetHostnameSuggestion -> GetHostnameSuggestion -> Bool)
-> Eq GetHostnameSuggestion
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]
(Int -> ReadS GetHostnameSuggestion)
-> ReadS [GetHostnameSuggestion]
-> ReadPrec GetHostnameSuggestion
-> ReadPrec [GetHostnameSuggestion]
-> Read 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
(Int -> GetHostnameSuggestion -> ShowS)
-> (GetHostnameSuggestion -> String)
-> ([GetHostnameSuggestion] -> ShowS)
-> Show GetHostnameSuggestion
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. GetHostnameSuggestion -> Rep GetHostnameSuggestion x)
-> (forall x. Rep GetHostnameSuggestion x -> GetHostnameSuggestion)
-> Generic GetHostnameSuggestion
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' :: Text -> GetHostnameSuggestion
GetHostnameSuggestion' {$sel:layerId:GetHostnameSuggestion' :: Text
layerId = Text
pLayerId_}
getHostnameSuggestion_layerId :: Lens.Lens' GetHostnameSuggestion Prelude.Text
getHostnameSuggestion_layerId :: (Text -> f Text)
-> GetHostnameSuggestion -> f GetHostnameSuggestion
getHostnameSuggestion_layerId = (GetHostnameSuggestion -> Text)
-> (GetHostnameSuggestion -> Text -> GetHostnameSuggestion)
-> Lens GetHostnameSuggestion GetHostnameSuggestion Text Text
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 :: GetHostnameSuggestion -> Request GetHostnameSuggestion
request = Service -> GetHostnameSuggestion -> Request GetHostnameSuggestion
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetHostnameSuggestion
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetHostnameSuggestion)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetHostnameSuggestion))
-> Logger
-> Service
-> Proxy GetHostnameSuggestion
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetHostnameSuggestion)))
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 -> Maybe Text -> Int -> GetHostnameSuggestionResponse
GetHostnameSuggestionResponse'
(Maybe Text -> Maybe Text -> Int -> GetHostnameSuggestionResponse)
-> Either String (Maybe Text)
-> Either
String (Maybe Text -> Int -> GetHostnameSuggestionResponse)
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
"Hostname")
Either String (Maybe Text -> Int -> GetHostnameSuggestionResponse)
-> Either String (Maybe Text)
-> Either String (Int -> GetHostnameSuggestionResponse)
forall (f :: * -> *) a b. Applicative f => 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
"LayerId")
Either String (Int -> GetHostnameSuggestionResponse)
-> Either String Int -> Either String GetHostnameSuggestionResponse
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 GetHostnameSuggestion
instance Prelude.NFData GetHostnameSuggestion
instance Core.ToHeaders GetHostnameSuggestion where
toHeaders :: GetHostnameSuggestion -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetHostnameSuggestion -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"OpsWorks_20130218.GetHostnameSuggestion" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON GetHostnameSuggestion where
toJSON :: GetHostnameSuggestion -> Value
toJSON GetHostnameSuggestion' {Text
layerId :: Text
$sel:layerId:GetHostnameSuggestion' :: GetHostnameSuggestion -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"LayerId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
layerId)]
)
instance Core.ToPath GetHostnameSuggestion where
toPath :: GetHostnameSuggestion -> ByteString
toPath = ByteString -> GetHostnameSuggestion -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetHostnameSuggestion where
toQuery :: GetHostnameSuggestion -> QueryString
toQuery = QueryString -> GetHostnameSuggestion -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(GetHostnameSuggestionResponse
-> GetHostnameSuggestionResponse -> Bool)
-> (GetHostnameSuggestionResponse
-> GetHostnameSuggestionResponse -> Bool)
-> Eq GetHostnameSuggestionResponse
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]
(Int -> ReadS GetHostnameSuggestionResponse)
-> ReadS [GetHostnameSuggestionResponse]
-> ReadPrec GetHostnameSuggestionResponse
-> ReadPrec [GetHostnameSuggestionResponse]
-> Read 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
(Int -> GetHostnameSuggestionResponse -> ShowS)
-> (GetHostnameSuggestionResponse -> String)
-> ([GetHostnameSuggestionResponse] -> ShowS)
-> Show GetHostnameSuggestionResponse
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.
GetHostnameSuggestionResponse
-> Rep GetHostnameSuggestionResponse x)
-> (forall x.
Rep GetHostnameSuggestionResponse x
-> GetHostnameSuggestionResponse)
-> Generic GetHostnameSuggestionResponse
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' :: Maybe Text -> Maybe Text -> Int -> GetHostnameSuggestionResponse
GetHostnameSuggestionResponse'
{ $sel:hostname:GetHostnameSuggestionResponse' :: Maybe Text
hostname =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:layerId:GetHostnameSuggestionResponse' :: Maybe Text
layerId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetHostnameSuggestionResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getHostnameSuggestionResponse_hostname :: Lens.Lens' GetHostnameSuggestionResponse (Prelude.Maybe Prelude.Text)
getHostnameSuggestionResponse_hostname :: (Maybe Text -> f (Maybe Text))
-> GetHostnameSuggestionResponse -> f GetHostnameSuggestionResponse
getHostnameSuggestionResponse_hostname = (GetHostnameSuggestionResponse -> Maybe Text)
-> (GetHostnameSuggestionResponse
-> Maybe Text -> GetHostnameSuggestionResponse)
-> Lens
GetHostnameSuggestionResponse
GetHostnameSuggestionResponse
(Maybe Text)
(Maybe Text)
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 :: (Maybe Text -> f (Maybe Text))
-> GetHostnameSuggestionResponse -> f GetHostnameSuggestionResponse
getHostnameSuggestionResponse_layerId = (GetHostnameSuggestionResponse -> Maybe Text)
-> (GetHostnameSuggestionResponse
-> Maybe Text -> GetHostnameSuggestionResponse)
-> Lens
GetHostnameSuggestionResponse
GetHostnameSuggestionResponse
(Maybe Text)
(Maybe Text)
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 :: (Int -> f Int)
-> GetHostnameSuggestionResponse -> f GetHostnameSuggestionResponse
getHostnameSuggestionResponse_httpStatus = (GetHostnameSuggestionResponse -> Int)
-> (GetHostnameSuggestionResponse
-> Int -> GetHostnameSuggestionResponse)
-> Lens
GetHostnameSuggestionResponse GetHostnameSuggestionResponse Int Int
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