{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.AutoScaling.Types.InstanceMetadataOptions where
import Amazonka.AutoScaling.Types.InstanceMetadataEndpointState
import Amazonka.AutoScaling.Types.InstanceMetadataHttpTokensState
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data InstanceMetadataOptions = InstanceMetadataOptions'
{
InstanceMetadataOptions -> Maybe InstanceMetadataEndpointState
httpEndpoint :: Prelude.Maybe InstanceMetadataEndpointState,
InstanceMetadataOptions -> Maybe Natural
httpPutResponseHopLimit :: Prelude.Maybe Prelude.Natural,
InstanceMetadataOptions -> Maybe InstanceMetadataHttpTokensState
httpTokens :: Prelude.Maybe InstanceMetadataHttpTokensState
}
deriving (InstanceMetadataOptions -> InstanceMetadataOptions -> Bool
(InstanceMetadataOptions -> InstanceMetadataOptions -> Bool)
-> (InstanceMetadataOptions -> InstanceMetadataOptions -> Bool)
-> Eq InstanceMetadataOptions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InstanceMetadataOptions -> InstanceMetadataOptions -> Bool
$c/= :: InstanceMetadataOptions -> InstanceMetadataOptions -> Bool
== :: InstanceMetadataOptions -> InstanceMetadataOptions -> Bool
$c== :: InstanceMetadataOptions -> InstanceMetadataOptions -> Bool
Prelude.Eq, ReadPrec [InstanceMetadataOptions]
ReadPrec InstanceMetadataOptions
Int -> ReadS InstanceMetadataOptions
ReadS [InstanceMetadataOptions]
(Int -> ReadS InstanceMetadataOptions)
-> ReadS [InstanceMetadataOptions]
-> ReadPrec InstanceMetadataOptions
-> ReadPrec [InstanceMetadataOptions]
-> Read InstanceMetadataOptions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InstanceMetadataOptions]
$creadListPrec :: ReadPrec [InstanceMetadataOptions]
readPrec :: ReadPrec InstanceMetadataOptions
$creadPrec :: ReadPrec InstanceMetadataOptions
readList :: ReadS [InstanceMetadataOptions]
$creadList :: ReadS [InstanceMetadataOptions]
readsPrec :: Int -> ReadS InstanceMetadataOptions
$creadsPrec :: Int -> ReadS InstanceMetadataOptions
Prelude.Read, Int -> InstanceMetadataOptions -> ShowS
[InstanceMetadataOptions] -> ShowS
InstanceMetadataOptions -> String
(Int -> InstanceMetadataOptions -> ShowS)
-> (InstanceMetadataOptions -> String)
-> ([InstanceMetadataOptions] -> ShowS)
-> Show InstanceMetadataOptions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InstanceMetadataOptions] -> ShowS
$cshowList :: [InstanceMetadataOptions] -> ShowS
show :: InstanceMetadataOptions -> String
$cshow :: InstanceMetadataOptions -> String
showsPrec :: Int -> InstanceMetadataOptions -> ShowS
$cshowsPrec :: Int -> InstanceMetadataOptions -> ShowS
Prelude.Show, (forall x.
InstanceMetadataOptions -> Rep InstanceMetadataOptions x)
-> (forall x.
Rep InstanceMetadataOptions x -> InstanceMetadataOptions)
-> Generic InstanceMetadataOptions
forall x. Rep InstanceMetadataOptions x -> InstanceMetadataOptions
forall x. InstanceMetadataOptions -> Rep InstanceMetadataOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InstanceMetadataOptions x -> InstanceMetadataOptions
$cfrom :: forall x. InstanceMetadataOptions -> Rep InstanceMetadataOptions x
Prelude.Generic)
newInstanceMetadataOptions ::
InstanceMetadataOptions
newInstanceMetadataOptions :: InstanceMetadataOptions
newInstanceMetadataOptions =
InstanceMetadataOptions' :: Maybe InstanceMetadataEndpointState
-> Maybe Natural
-> Maybe InstanceMetadataHttpTokensState
-> InstanceMetadataOptions
InstanceMetadataOptions'
{ $sel:httpEndpoint:InstanceMetadataOptions' :: Maybe InstanceMetadataEndpointState
httpEndpoint =
Maybe InstanceMetadataEndpointState
forall a. Maybe a
Prelude.Nothing,
$sel:httpPutResponseHopLimit:InstanceMetadataOptions' :: Maybe Natural
httpPutResponseHopLimit = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:httpTokens:InstanceMetadataOptions' :: Maybe InstanceMetadataHttpTokensState
httpTokens = Maybe InstanceMetadataHttpTokensState
forall a. Maybe a
Prelude.Nothing
}
instanceMetadataOptions_httpEndpoint :: Lens.Lens' InstanceMetadataOptions (Prelude.Maybe InstanceMetadataEndpointState)
instanceMetadataOptions_httpEndpoint :: (Maybe InstanceMetadataEndpointState
-> f (Maybe InstanceMetadataEndpointState))
-> InstanceMetadataOptions -> f InstanceMetadataOptions
instanceMetadataOptions_httpEndpoint = (InstanceMetadataOptions -> Maybe InstanceMetadataEndpointState)
-> (InstanceMetadataOptions
-> Maybe InstanceMetadataEndpointState -> InstanceMetadataOptions)
-> Lens
InstanceMetadataOptions
InstanceMetadataOptions
(Maybe InstanceMetadataEndpointState)
(Maybe InstanceMetadataEndpointState)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceMetadataOptions' {Maybe InstanceMetadataEndpointState
httpEndpoint :: Maybe InstanceMetadataEndpointState
$sel:httpEndpoint:InstanceMetadataOptions' :: InstanceMetadataOptions -> Maybe InstanceMetadataEndpointState
httpEndpoint} -> Maybe InstanceMetadataEndpointState
httpEndpoint) (\s :: InstanceMetadataOptions
s@InstanceMetadataOptions' {} Maybe InstanceMetadataEndpointState
a -> InstanceMetadataOptions
s {$sel:httpEndpoint:InstanceMetadataOptions' :: Maybe InstanceMetadataEndpointState
httpEndpoint = Maybe InstanceMetadataEndpointState
a} :: InstanceMetadataOptions)
instanceMetadataOptions_httpPutResponseHopLimit :: Lens.Lens' InstanceMetadataOptions (Prelude.Maybe Prelude.Natural)
instanceMetadataOptions_httpPutResponseHopLimit :: (Maybe Natural -> f (Maybe Natural))
-> InstanceMetadataOptions -> f InstanceMetadataOptions
instanceMetadataOptions_httpPutResponseHopLimit = (InstanceMetadataOptions -> Maybe Natural)
-> (InstanceMetadataOptions
-> Maybe Natural -> InstanceMetadataOptions)
-> Lens
InstanceMetadataOptions
InstanceMetadataOptions
(Maybe Natural)
(Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceMetadataOptions' {Maybe Natural
httpPutResponseHopLimit :: Maybe Natural
$sel:httpPutResponseHopLimit:InstanceMetadataOptions' :: InstanceMetadataOptions -> Maybe Natural
httpPutResponseHopLimit} -> Maybe Natural
httpPutResponseHopLimit) (\s :: InstanceMetadataOptions
s@InstanceMetadataOptions' {} Maybe Natural
a -> InstanceMetadataOptions
s {$sel:httpPutResponseHopLimit:InstanceMetadataOptions' :: Maybe Natural
httpPutResponseHopLimit = Maybe Natural
a} :: InstanceMetadataOptions)
instanceMetadataOptions_httpTokens :: Lens.Lens' InstanceMetadataOptions (Prelude.Maybe InstanceMetadataHttpTokensState)
instanceMetadataOptions_httpTokens :: (Maybe InstanceMetadataHttpTokensState
-> f (Maybe InstanceMetadataHttpTokensState))
-> InstanceMetadataOptions -> f InstanceMetadataOptions
instanceMetadataOptions_httpTokens = (InstanceMetadataOptions -> Maybe InstanceMetadataHttpTokensState)
-> (InstanceMetadataOptions
-> Maybe InstanceMetadataHttpTokensState
-> InstanceMetadataOptions)
-> Lens
InstanceMetadataOptions
InstanceMetadataOptions
(Maybe InstanceMetadataHttpTokensState)
(Maybe InstanceMetadataHttpTokensState)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceMetadataOptions' {Maybe InstanceMetadataHttpTokensState
httpTokens :: Maybe InstanceMetadataHttpTokensState
$sel:httpTokens:InstanceMetadataOptions' :: InstanceMetadataOptions -> Maybe InstanceMetadataHttpTokensState
httpTokens} -> Maybe InstanceMetadataHttpTokensState
httpTokens) (\s :: InstanceMetadataOptions
s@InstanceMetadataOptions' {} Maybe InstanceMetadataHttpTokensState
a -> InstanceMetadataOptions
s {$sel:httpTokens:InstanceMetadataOptions' :: Maybe InstanceMetadataHttpTokensState
httpTokens = Maybe InstanceMetadataHttpTokensState
a} :: InstanceMetadataOptions)
instance Core.FromXML InstanceMetadataOptions where
parseXML :: [Node] -> Either String InstanceMetadataOptions
parseXML [Node]
x =
Maybe InstanceMetadataEndpointState
-> Maybe Natural
-> Maybe InstanceMetadataHttpTokensState
-> InstanceMetadataOptions
InstanceMetadataOptions'
(Maybe InstanceMetadataEndpointState
-> Maybe Natural
-> Maybe InstanceMetadataHttpTokensState
-> InstanceMetadataOptions)
-> Either String (Maybe InstanceMetadataEndpointState)
-> Either
String
(Maybe Natural
-> Maybe InstanceMetadataHttpTokensState
-> InstanceMetadataOptions)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node]
-> Text -> Either String (Maybe InstanceMetadataEndpointState)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"HttpEndpoint")
Either
String
(Maybe Natural
-> Maybe InstanceMetadataHttpTokensState
-> InstanceMetadataOptions)
-> Either String (Maybe Natural)
-> Either
String
(Maybe InstanceMetadataHttpTokensState -> InstanceMetadataOptions)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Natural)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"HttpPutResponseHopLimit")
Either
String
(Maybe InstanceMetadataHttpTokensState -> InstanceMetadataOptions)
-> Either String (Maybe InstanceMetadataHttpTokensState)
-> Either String InstanceMetadataOptions
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node]
-> Text -> Either String (Maybe InstanceMetadataHttpTokensState)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"HttpTokens")
instance Prelude.Hashable InstanceMetadataOptions
instance Prelude.NFData InstanceMetadataOptions
instance Core.ToQuery InstanceMetadataOptions where
toQuery :: InstanceMetadataOptions -> QueryString
toQuery InstanceMetadataOptions' {Maybe Natural
Maybe InstanceMetadataEndpointState
Maybe InstanceMetadataHttpTokensState
httpTokens :: Maybe InstanceMetadataHttpTokensState
httpPutResponseHopLimit :: Maybe Natural
httpEndpoint :: Maybe InstanceMetadataEndpointState
$sel:httpTokens:InstanceMetadataOptions' :: InstanceMetadataOptions -> Maybe InstanceMetadataHttpTokensState
$sel:httpPutResponseHopLimit:InstanceMetadataOptions' :: InstanceMetadataOptions -> Maybe Natural
$sel:httpEndpoint:InstanceMetadataOptions' :: InstanceMetadataOptions -> Maybe InstanceMetadataEndpointState
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"HttpEndpoint" ByteString -> Maybe InstanceMetadataEndpointState -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe InstanceMetadataEndpointState
httpEndpoint,
ByteString
"HttpPutResponseHopLimit"
ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
httpPutResponseHopLimit,
ByteString
"HttpTokens" ByteString -> Maybe InstanceMetadataHttpTokensState -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe InstanceMetadataHttpTokensState
httpTokens
]