{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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'
{ $sel:fleetInstanceId:ConfigureAgent' :: Maybe Text
fleetInstanceId = forall a. Maybe a
Prelude.Nothing,
$sel:metadata:ConfigureAgent' :: Maybe (HashMap MetadataField Text)
metadata = forall a. Maybe a
Prelude.Nothing,
$sel:profilingGroupName:ConfigureAgent' :: Text
profilingGroupName = Text
pProfilingGroupName_
}
configureAgent_fleetInstanceId :: Lens.Lens' ConfigureAgent (Prelude.Maybe Prelude.Text)
configureAgent_fleetInstanceId :: Lens' ConfigureAgent (Maybe Text)
configureAgent_fleetInstanceId = 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 :: Lens' ConfigureAgent (Maybe (HashMap MetadataField Text))
configureAgent_metadata = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 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 :: Lens' ConfigureAgent Text
configureAgent_profilingGroupName = 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 :: (Service -> Service) -> ConfigureAgent -> Request ConfigureAgent
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 ConfigureAgent
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ConfigureAgent)))
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 ->
Int -> AgentConfiguration -> ConfigureAgentResponse
ConfigureAgentResponse'
forall (f :: * -> *) a b. Functor 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))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall a. FromJSON a => Object -> Either String a
Data.eitherParseJSON Object
x)
)
instance Prelude.Hashable ConfigureAgent where
hashWithSalt :: Int -> ConfigureAgent -> Int
hashWithSalt Int
_salt 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
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
fleetInstanceId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap MetadataField Text)
metadata
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
profilingGroupName
instance Prelude.NFData ConfigureAgent where
rnf :: ConfigureAgent -> ()
rnf 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
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
fleetInstanceId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap MetadataField Text)
metadata
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
profilingGroupName
instance Data.ToHeaders ConfigureAgent where
toHeaders :: ConfigureAgent -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.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
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"fleetInstanceId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
fleetInstanceId,
(Key
"metadata" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap MetadataField Text)
metadata
]
)
instance Data.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
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/profilingGroups/",
forall a. ToByteString a => a -> ByteString
Data.toBS Text
profilingGroupName,
ByteString
"/configureAgent"
]
instance Data.ToQuery ConfigureAgent where
toQuery :: ConfigureAgent -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data ConfigureAgentResponse = ConfigureAgentResponse'
{
ConfigureAgentResponse -> Int
httpStatus :: Prelude.Int,
ConfigureAgentResponse -> AgentConfiguration
configuration :: AgentConfiguration
}
deriving (ConfigureAgentResponse -> ConfigureAgentResponse -> Bool
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]
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
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. 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'
{ $sel:httpStatus:ConfigureAgentResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:configuration:ConfigureAgentResponse' :: AgentConfiguration
configuration = AgentConfiguration
pConfiguration_
}
configureAgentResponse_httpStatus :: Lens.Lens' ConfigureAgentResponse Prelude.Int
configureAgentResponse_httpStatus :: Lens' ConfigureAgentResponse Int
configureAgentResponse_httpStatus = 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 :: Lens' ConfigureAgentResponse AgentConfiguration
configureAgentResponse_configuration = 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 where
rnf :: ConfigureAgentResponse -> ()
rnf ConfigureAgentResponse' {Int
AgentConfiguration
configuration :: AgentConfiguration
httpStatus :: Int
$sel:configuration:ConfigureAgentResponse' :: ConfigureAgentResponse -> AgentConfiguration
$sel:httpStatus:ConfigureAgentResponse' :: ConfigureAgentResponse -> Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf AgentConfiguration
configuration