{-# 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.GroundStation.UpdateConfig
(
UpdateConfig (..),
newUpdateConfig,
updateConfig_configData,
updateConfig_configId,
updateConfig_configType,
updateConfig_name,
ConfigIdResponse (..),
newConfigIdResponse,
configIdResponse_configArn,
configIdResponse_configId,
configIdResponse_configType,
)
where
import qualified Amazonka.Core as Core
import Amazonka.GroundStation.Types
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 UpdateConfig = UpdateConfig'
{
UpdateConfig -> ConfigTypeData
configData :: ConfigTypeData,
UpdateConfig -> Text
configId :: Prelude.Text,
UpdateConfig -> ConfigCapabilityType
configType :: ConfigCapabilityType,
UpdateConfig -> Text
name :: Prelude.Text
}
deriving (UpdateConfig -> UpdateConfig -> Bool
(UpdateConfig -> UpdateConfig -> Bool)
-> (UpdateConfig -> UpdateConfig -> Bool) -> Eq UpdateConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateConfig -> UpdateConfig -> Bool
$c/= :: UpdateConfig -> UpdateConfig -> Bool
== :: UpdateConfig -> UpdateConfig -> Bool
$c== :: UpdateConfig -> UpdateConfig -> Bool
Prelude.Eq, ReadPrec [UpdateConfig]
ReadPrec UpdateConfig
Int -> ReadS UpdateConfig
ReadS [UpdateConfig]
(Int -> ReadS UpdateConfig)
-> ReadS [UpdateConfig]
-> ReadPrec UpdateConfig
-> ReadPrec [UpdateConfig]
-> Read UpdateConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateConfig]
$creadListPrec :: ReadPrec [UpdateConfig]
readPrec :: ReadPrec UpdateConfig
$creadPrec :: ReadPrec UpdateConfig
readList :: ReadS [UpdateConfig]
$creadList :: ReadS [UpdateConfig]
readsPrec :: Int -> ReadS UpdateConfig
$creadsPrec :: Int -> ReadS UpdateConfig
Prelude.Read, Int -> UpdateConfig -> ShowS
[UpdateConfig] -> ShowS
UpdateConfig -> String
(Int -> UpdateConfig -> ShowS)
-> (UpdateConfig -> String)
-> ([UpdateConfig] -> ShowS)
-> Show UpdateConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateConfig] -> ShowS
$cshowList :: [UpdateConfig] -> ShowS
show :: UpdateConfig -> String
$cshow :: UpdateConfig -> String
showsPrec :: Int -> UpdateConfig -> ShowS
$cshowsPrec :: Int -> UpdateConfig -> ShowS
Prelude.Show, (forall x. UpdateConfig -> Rep UpdateConfig x)
-> (forall x. Rep UpdateConfig x -> UpdateConfig)
-> Generic UpdateConfig
forall x. Rep UpdateConfig x -> UpdateConfig
forall x. UpdateConfig -> Rep UpdateConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateConfig x -> UpdateConfig
$cfrom :: forall x. UpdateConfig -> Rep UpdateConfig x
Prelude.Generic)
newUpdateConfig ::
ConfigTypeData ->
Prelude.Text ->
ConfigCapabilityType ->
Prelude.Text ->
UpdateConfig
newUpdateConfig :: ConfigTypeData
-> Text -> ConfigCapabilityType -> Text -> UpdateConfig
newUpdateConfig
ConfigTypeData
pConfigData_
Text
pConfigId_
ConfigCapabilityType
pConfigType_
Text
pName_ =
UpdateConfig' :: ConfigTypeData
-> Text -> ConfigCapabilityType -> Text -> UpdateConfig
UpdateConfig'
{ $sel:configData:UpdateConfig' :: ConfigTypeData
configData = ConfigTypeData
pConfigData_,
$sel:configId:UpdateConfig' :: Text
configId = Text
pConfigId_,
$sel:configType:UpdateConfig' :: ConfigCapabilityType
configType = ConfigCapabilityType
pConfigType_,
$sel:name:UpdateConfig' :: Text
name = Text
pName_
}
updateConfig_configData :: Lens.Lens' UpdateConfig ConfigTypeData
updateConfig_configData :: (ConfigTypeData -> f ConfigTypeData)
-> UpdateConfig -> f UpdateConfig
updateConfig_configData = (UpdateConfig -> ConfigTypeData)
-> (UpdateConfig -> ConfigTypeData -> UpdateConfig)
-> Lens UpdateConfig UpdateConfig ConfigTypeData ConfigTypeData
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateConfig' {ConfigTypeData
configData :: ConfigTypeData
$sel:configData:UpdateConfig' :: UpdateConfig -> ConfigTypeData
configData} -> ConfigTypeData
configData) (\s :: UpdateConfig
s@UpdateConfig' {} ConfigTypeData
a -> UpdateConfig
s {$sel:configData:UpdateConfig' :: ConfigTypeData
configData = ConfigTypeData
a} :: UpdateConfig)
updateConfig_configId :: Lens.Lens' UpdateConfig Prelude.Text
updateConfig_configId :: (Text -> f Text) -> UpdateConfig -> f UpdateConfig
updateConfig_configId = (UpdateConfig -> Text)
-> (UpdateConfig -> Text -> UpdateConfig)
-> Lens UpdateConfig UpdateConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateConfig' {Text
configId :: Text
$sel:configId:UpdateConfig' :: UpdateConfig -> Text
configId} -> Text
configId) (\s :: UpdateConfig
s@UpdateConfig' {} Text
a -> UpdateConfig
s {$sel:configId:UpdateConfig' :: Text
configId = Text
a} :: UpdateConfig)
updateConfig_configType :: Lens.Lens' UpdateConfig ConfigCapabilityType
updateConfig_configType :: (ConfigCapabilityType -> f ConfigCapabilityType)
-> UpdateConfig -> f UpdateConfig
updateConfig_configType = (UpdateConfig -> ConfigCapabilityType)
-> (UpdateConfig -> ConfigCapabilityType -> UpdateConfig)
-> Lens
UpdateConfig UpdateConfig ConfigCapabilityType ConfigCapabilityType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateConfig' {ConfigCapabilityType
configType :: ConfigCapabilityType
$sel:configType:UpdateConfig' :: UpdateConfig -> ConfigCapabilityType
configType} -> ConfigCapabilityType
configType) (\s :: UpdateConfig
s@UpdateConfig' {} ConfigCapabilityType
a -> UpdateConfig
s {$sel:configType:UpdateConfig' :: ConfigCapabilityType
configType = ConfigCapabilityType
a} :: UpdateConfig)
updateConfig_name :: Lens.Lens' UpdateConfig Prelude.Text
updateConfig_name :: (Text -> f Text) -> UpdateConfig -> f UpdateConfig
updateConfig_name = (UpdateConfig -> Text)
-> (UpdateConfig -> Text -> UpdateConfig)
-> Lens UpdateConfig UpdateConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateConfig' {Text
name :: Text
$sel:name:UpdateConfig' :: UpdateConfig -> Text
name} -> Text
name) (\s :: UpdateConfig
s@UpdateConfig' {} Text
a -> UpdateConfig
s {$sel:name:UpdateConfig' :: Text
name = Text
a} :: UpdateConfig)
instance Core.AWSRequest UpdateConfig where
type AWSResponse UpdateConfig = ConfigIdResponse
request :: UpdateConfig -> Request UpdateConfig
request = Service -> UpdateConfig -> Request UpdateConfig
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateConfig
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateConfig)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateConfig))
-> Logger
-> Service
-> Proxy UpdateConfig
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateConfig)))
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 -> Object -> Either String ConfigIdResponse
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
instance Prelude.Hashable UpdateConfig
instance Prelude.NFData UpdateConfig
instance Core.ToHeaders UpdateConfig where
toHeaders :: UpdateConfig -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateConfig -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ 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 UpdateConfig where
toJSON :: UpdateConfig -> Value
toJSON UpdateConfig' {Text
ConfigCapabilityType
ConfigTypeData
name :: Text
configType :: ConfigCapabilityType
configId :: Text
configData :: ConfigTypeData
$sel:name:UpdateConfig' :: UpdateConfig -> Text
$sel:configType:UpdateConfig' :: UpdateConfig -> ConfigCapabilityType
$sel:configId:UpdateConfig' :: UpdateConfig -> Text
$sel:configData:UpdateConfig' :: UpdateConfig -> ConfigTypeData
..} =
[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
"configData" Text -> ConfigTypeData -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ConfigTypeData
configData),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name)
]
)
instance Core.ToPath UpdateConfig where
toPath :: UpdateConfig -> ByteString
toPath UpdateConfig' {Text
ConfigCapabilityType
ConfigTypeData
name :: Text
configType :: ConfigCapabilityType
configId :: Text
configData :: ConfigTypeData
$sel:name:UpdateConfig' :: UpdateConfig -> Text
$sel:configType:UpdateConfig' :: UpdateConfig -> ConfigCapabilityType
$sel:configId:UpdateConfig' :: UpdateConfig -> Text
$sel:configData:UpdateConfig' :: UpdateConfig -> ConfigTypeData
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/config/",
ConfigCapabilityType -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS ConfigCapabilityType
configType,
ByteString
"/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
configId
]
instance Core.ToQuery UpdateConfig where
toQuery :: UpdateConfig -> QueryString
toQuery = QueryString -> UpdateConfig -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty