{-# 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.CodeGuruProfiler.ConfigureAgent
(
ConfigureAgent (..),
newConfigureAgent,
configureAgent_fleetInstanceId,
configureAgent_metadata,
configureAgent_profilingGroupName,
ConfigureAgentResponse (..),
newConfigureAgentResponse,
configureAgentResponse_httpStatus,
configureAgentResponse_configuration,
)
where
import Amazonka.CodeGuruProfiler.Types
import qualified Amazonka.Core as Core
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 ConfigureAgent = ConfigureAgent'
{
ConfigureAgent -> Maybe Text
fleetInstanceId :: Prelude.Maybe Prelude.Text,
ConfigureAgent -> Maybe (HashMap MetadataField Text)
metadata :: Prelude.Maybe (Prelude.HashMap MetadataField Prelude.Text),
ConfigureAgent -> Text
profilingGroupName :: Prelude.Text
}
deriving (ConfigureAgent -> ConfigureAgent -> Bool
(ConfigureAgent -> ConfigureAgent -> Bool)
-> (ConfigureAgent -> ConfigureAgent -> Bool) -> Eq ConfigureAgent
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConfigureAgent -> ConfigureAgent -> Bool
$c/= :: ConfigureAgent -> ConfigureAgent -> Bool
== :: ConfigureAgent -> ConfigureAgent -> Bool
$c== :: ConfigureAgent -> ConfigureAgent -> Bool
Prelude.Eq, ReadPrec [ConfigureAgent]
ReadPrec ConfigureAgent
Int -> ReadS ConfigureAgent
ReadS [ConfigureAgent]
(Int -> ReadS ConfigureAgent)
-> ReadS [ConfigureAgent]
-> ReadPrec ConfigureAgent
-> ReadPrec [ConfigureAgent]
-> Read ConfigureAgent
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ConfigureAgent]
$creadListPrec :: ReadPrec [ConfigureAgent]
readPrec :: ReadPrec ConfigureAgent
$creadPrec :: ReadPrec ConfigureAgent
readList :: ReadS [ConfigureAgent]
$creadList :: ReadS [ConfigureAgent]
readsPrec :: Int -> ReadS ConfigureAgent
$creadsPrec :: Int -> ReadS ConfigureAgent
Prelude.Read, Int -> ConfigureAgent -> ShowS
[ConfigureAgent] -> ShowS
ConfigureAgent -> String
(Int -> ConfigureAgent -> ShowS)
-> (ConfigureAgent -> String)
-> ([ConfigureAgent] -> ShowS)
-> Show ConfigureAgent
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConfigureAgent] -> ShowS
$cshowList :: [ConfigureAgent] -> ShowS
show :: ConfigureAgent -> String
$cshow :: ConfigureAgent -> String
showsPrec :: Int -> ConfigureAgent -> ShowS
$cshowsPrec :: Int -> ConfigureAgent -> ShowS
Prelude.Show, (forall x. ConfigureAgent -> Rep ConfigureAgent x)
-> (forall x. Rep ConfigureAgent x -> ConfigureAgent)
-> Generic ConfigureAgent
forall x. Rep ConfigureAgent x -> ConfigureAgent
forall x. ConfigureAgent -> Rep ConfigureAgent x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ConfigureAgent x -> ConfigureAgent
$cfrom :: forall x. ConfigureAgent -> Rep ConfigureAgent x
Prelude.Generic)
newConfigureAgent ::
Prelude.Text ->
ConfigureAgent
newConfigureAgent :: Text -> ConfigureAgent
newConfigureAgent Text
pProfilingGroupName_ =
ConfigureAgent' :: Maybe Text
-> Maybe (HashMap MetadataField Text) -> Text -> ConfigureAgent
ConfigureAgent'
{ $sel:fleetInstanceId:ConfigureAgent' :: Maybe Text
fleetInstanceId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:metadata:ConfigureAgent' :: Maybe (HashMap MetadataField Text)
metadata = Maybe (HashMap MetadataField Text)
forall a. Maybe a
Prelude.Nothing,
$sel:profilingGroupName:ConfigureAgent' :: Text
profilingGroupName = Text
pProfilingGroupName_
}
configureAgent_fleetInstanceId :: Lens.Lens' ConfigureAgent (Prelude.Maybe Prelude.Text)
configureAgent_fleetInstanceId :: (Maybe Text -> f (Maybe Text))
-> ConfigureAgent -> f ConfigureAgent
configureAgent_fleetInstanceId = (ConfigureAgent -> Maybe Text)
-> (ConfigureAgent -> Maybe Text -> ConfigureAgent)
-> Lens ConfigureAgent ConfigureAgent (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfigureAgent' {Maybe Text
fleetInstanceId :: Maybe Text
$sel:fleetInstanceId:ConfigureAgent' :: ConfigureAgent -> Maybe Text
fleetInstanceId} -> Maybe Text
fleetInstanceId) (\s :: ConfigureAgent
s@ConfigureAgent' {} Maybe Text
a -> ConfigureAgent
s {$sel:fleetInstanceId:ConfigureAgent' :: Maybe Text
fleetInstanceId = Maybe Text
a} :: ConfigureAgent)
configureAgent_metadata :: Lens.Lens' ConfigureAgent (Prelude.Maybe (Prelude.HashMap MetadataField Prelude.Text))
configureAgent_metadata :: (Maybe (HashMap MetadataField Text)
-> f (Maybe (HashMap MetadataField Text)))
-> ConfigureAgent -> f ConfigureAgent
configureAgent_metadata = (ConfigureAgent -> Maybe (HashMap MetadataField Text))
-> (ConfigureAgent
-> Maybe (HashMap MetadataField Text) -> ConfigureAgent)
-> Lens
ConfigureAgent
ConfigureAgent
(Maybe (HashMap MetadataField Text))
(Maybe (HashMap MetadataField Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfigureAgent' {Maybe (HashMap MetadataField Text)
metadata :: Maybe (HashMap MetadataField Text)
$sel:metadata:ConfigureAgent' :: ConfigureAgent -> Maybe (HashMap MetadataField Text)
metadata} -> Maybe (HashMap MetadataField Text)
metadata) (\s :: ConfigureAgent
s@ConfigureAgent' {} Maybe (HashMap MetadataField Text)
a -> ConfigureAgent
s {$sel:metadata:ConfigureAgent' :: Maybe (HashMap MetadataField Text)
metadata = Maybe (HashMap MetadataField Text)
a} :: ConfigureAgent) ((Maybe (HashMap MetadataField Text)
-> f (Maybe (HashMap MetadataField Text)))
-> ConfigureAgent -> f ConfigureAgent)
-> ((Maybe (HashMap MetadataField Text)
-> f (Maybe (HashMap MetadataField Text)))
-> Maybe (HashMap MetadataField Text)
-> f (Maybe (HashMap MetadataField Text)))
-> (Maybe (HashMap MetadataField Text)
-> f (Maybe (HashMap MetadataField Text)))
-> ConfigureAgent
-> f ConfigureAgent
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap MetadataField Text)
(HashMap MetadataField Text)
(HashMap MetadataField Text)
(HashMap MetadataField Text)
-> Iso
(Maybe (HashMap MetadataField Text))
(Maybe (HashMap MetadataField Text))
(Maybe (HashMap MetadataField Text))
(Maybe (HashMap MetadataField Text))
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 AnIso
(HashMap MetadataField Text)
(HashMap MetadataField Text)
(HashMap MetadataField Text)
(HashMap MetadataField Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
configureAgent_profilingGroupName :: Lens.Lens' ConfigureAgent Prelude.Text
configureAgent_profilingGroupName :: (Text -> f Text) -> ConfigureAgent -> f ConfigureAgent
configureAgent_profilingGroupName = (ConfigureAgent -> Text)
-> (ConfigureAgent -> Text -> ConfigureAgent)
-> Lens ConfigureAgent ConfigureAgent Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfigureAgent' {Text
profilingGroupName :: Text
$sel:profilingGroupName:ConfigureAgent' :: ConfigureAgent -> Text
profilingGroupName} -> Text
profilingGroupName) (\s :: ConfigureAgent
s@ConfigureAgent' {} Text
a -> ConfigureAgent
s {$sel:profilingGroupName:ConfigureAgent' :: Text
profilingGroupName = Text
a} :: ConfigureAgent)
instance Core.AWSRequest ConfigureAgent where
type
AWSResponse ConfigureAgent =
ConfigureAgentResponse
request :: ConfigureAgent -> Request ConfigureAgent
request = Service -> ConfigureAgent -> Request ConfigureAgent
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy ConfigureAgent
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ConfigureAgent)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ConfigureAgent))
-> Logger
-> Service
-> Proxy ConfigureAgent
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ConfigureAgent)))
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 ->
Int -> AgentConfiguration -> ConfigureAgentResponse
ConfigureAgentResponse'
(Int -> AgentConfiguration -> ConfigureAgentResponse)
-> Either String Int
-> Either String (AgentConfiguration -> ConfigureAgentResponse)
forall (f :: * -> *) a b. Functor 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))
Either String (AgentConfiguration -> ConfigureAgentResponse)
-> Either String AgentConfiguration
-> Either String ConfigureAgentResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object -> Either String AgentConfiguration
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
)
instance Prelude.Hashable ConfigureAgent
instance Prelude.NFData ConfigureAgent
instance Core.ToHeaders ConfigureAgent where
toHeaders :: ConfigureAgent -> ResponseHeaders
toHeaders =
ResponseHeaders -> ConfigureAgent -> 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 ConfigureAgent where
toJSON :: ConfigureAgent -> Value
toJSON ConfigureAgent' {Maybe Text
Maybe (HashMap MetadataField Text)
Text
profilingGroupName :: Text
metadata :: Maybe (HashMap MetadataField Text)
fleetInstanceId :: Maybe Text
$sel:profilingGroupName:ConfigureAgent' :: ConfigureAgent -> Text
$sel:metadata:ConfigureAgent' :: ConfigureAgent -> Maybe (HashMap MetadataField Text)
$sel:fleetInstanceId:ConfigureAgent' :: ConfigureAgent -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"fleetInstanceId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
fleetInstanceId,
(Text
"metadata" Text -> HashMap MetadataField Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap MetadataField Text -> Pair)
-> Maybe (HashMap MetadataField Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap MetadataField Text)
metadata
]
)
instance Core.ToPath ConfigureAgent where
toPath :: ConfigureAgent -> ByteString
toPath ConfigureAgent' {Maybe Text
Maybe (HashMap MetadataField Text)
Text
profilingGroupName :: Text
metadata :: Maybe (HashMap MetadataField Text)
fleetInstanceId :: Maybe Text
$sel:profilingGroupName:ConfigureAgent' :: ConfigureAgent -> Text
$sel:metadata:ConfigureAgent' :: ConfigureAgent -> Maybe (HashMap MetadataField Text)
$sel:fleetInstanceId:ConfigureAgent' :: ConfigureAgent -> Maybe Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/profilingGroups/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
profilingGroupName,
ByteString
"/configureAgent"
]
instance Core.ToQuery ConfigureAgent where
toQuery :: ConfigureAgent -> QueryString
toQuery = QueryString -> ConfigureAgent -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data ConfigureAgentResponse = ConfigureAgentResponse'
{
ConfigureAgentResponse -> Int
httpStatus :: Prelude.Int,
ConfigureAgentResponse -> AgentConfiguration
configuration :: AgentConfiguration
}
deriving (ConfigureAgentResponse -> ConfigureAgentResponse -> Bool
(ConfigureAgentResponse -> ConfigureAgentResponse -> Bool)
-> (ConfigureAgentResponse -> ConfigureAgentResponse -> Bool)
-> Eq ConfigureAgentResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConfigureAgentResponse -> ConfigureAgentResponse -> Bool
$c/= :: ConfigureAgentResponse -> ConfigureAgentResponse -> Bool
== :: ConfigureAgentResponse -> ConfigureAgentResponse -> Bool
$c== :: ConfigureAgentResponse -> ConfigureAgentResponse -> Bool
Prelude.Eq, ReadPrec [ConfigureAgentResponse]
ReadPrec ConfigureAgentResponse
Int -> ReadS ConfigureAgentResponse
ReadS [ConfigureAgentResponse]
(Int -> ReadS ConfigureAgentResponse)
-> ReadS [ConfigureAgentResponse]
-> ReadPrec ConfigureAgentResponse
-> ReadPrec [ConfigureAgentResponse]
-> Read ConfigureAgentResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ConfigureAgentResponse]
$creadListPrec :: ReadPrec [ConfigureAgentResponse]
readPrec :: ReadPrec ConfigureAgentResponse
$creadPrec :: ReadPrec ConfigureAgentResponse
readList :: ReadS [ConfigureAgentResponse]
$creadList :: ReadS [ConfigureAgentResponse]
readsPrec :: Int -> ReadS ConfigureAgentResponse
$creadsPrec :: Int -> ReadS ConfigureAgentResponse
Prelude.Read, Int -> ConfigureAgentResponse -> ShowS
[ConfigureAgentResponse] -> ShowS
ConfigureAgentResponse -> String
(Int -> ConfigureAgentResponse -> ShowS)
-> (ConfigureAgentResponse -> String)
-> ([ConfigureAgentResponse] -> ShowS)
-> Show ConfigureAgentResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConfigureAgentResponse] -> ShowS
$cshowList :: [ConfigureAgentResponse] -> ShowS
show :: ConfigureAgentResponse -> String
$cshow :: ConfigureAgentResponse -> String
showsPrec :: Int -> ConfigureAgentResponse -> ShowS
$cshowsPrec :: Int -> ConfigureAgentResponse -> ShowS
Prelude.Show, (forall x. ConfigureAgentResponse -> Rep ConfigureAgentResponse x)
-> (forall x.
Rep ConfigureAgentResponse x -> ConfigureAgentResponse)
-> Generic ConfigureAgentResponse
forall x. Rep ConfigureAgentResponse x -> ConfigureAgentResponse
forall x. ConfigureAgentResponse -> Rep ConfigureAgentResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ConfigureAgentResponse x -> ConfigureAgentResponse
$cfrom :: forall x. ConfigureAgentResponse -> Rep ConfigureAgentResponse x
Prelude.Generic)
newConfigureAgentResponse ::
Prelude.Int ->
AgentConfiguration ->
ConfigureAgentResponse
newConfigureAgentResponse :: Int -> AgentConfiguration -> ConfigureAgentResponse
newConfigureAgentResponse
Int
pHttpStatus_
AgentConfiguration
pConfiguration_ =
ConfigureAgentResponse' :: Int -> AgentConfiguration -> ConfigureAgentResponse
ConfigureAgentResponse'
{ $sel:httpStatus:ConfigureAgentResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:configuration:ConfigureAgentResponse' :: AgentConfiguration
configuration = AgentConfiguration
pConfiguration_
}
configureAgentResponse_httpStatus :: Lens.Lens' ConfigureAgentResponse Prelude.Int
configureAgentResponse_httpStatus :: (Int -> f Int)
-> ConfigureAgentResponse -> f ConfigureAgentResponse
configureAgentResponse_httpStatus = (ConfigureAgentResponse -> Int)
-> (ConfigureAgentResponse -> Int -> ConfigureAgentResponse)
-> Lens ConfigureAgentResponse ConfigureAgentResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfigureAgentResponse' {Int
httpStatus :: Int
$sel:httpStatus:ConfigureAgentResponse' :: ConfigureAgentResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ConfigureAgentResponse
s@ConfigureAgentResponse' {} Int
a -> ConfigureAgentResponse
s {$sel:httpStatus:ConfigureAgentResponse' :: Int
httpStatus = Int
a} :: ConfigureAgentResponse)
configureAgentResponse_configuration :: Lens.Lens' ConfigureAgentResponse AgentConfiguration
configureAgentResponse_configuration :: (AgentConfiguration -> f AgentConfiguration)
-> ConfigureAgentResponse -> f ConfigureAgentResponse
configureAgentResponse_configuration = (ConfigureAgentResponse -> AgentConfiguration)
-> (ConfigureAgentResponse
-> AgentConfiguration -> ConfigureAgentResponse)
-> Lens
ConfigureAgentResponse
ConfigureAgentResponse
AgentConfiguration
AgentConfiguration
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfigureAgentResponse' {AgentConfiguration
configuration :: AgentConfiguration
$sel:configuration:ConfigureAgentResponse' :: ConfigureAgentResponse -> AgentConfiguration
configuration} -> AgentConfiguration
configuration) (\s :: ConfigureAgentResponse
s@ConfigureAgentResponse' {} AgentConfiguration
a -> ConfigureAgentResponse
s {$sel:configuration:ConfigureAgentResponse' :: AgentConfiguration
configuration = AgentConfiguration
a} :: ConfigureAgentResponse)
instance Prelude.NFData ConfigureAgentResponse