{-# 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.SSM.PutInventory
(
PutInventory (..),
newPutInventory,
putInventory_instanceId,
putInventory_items,
PutInventoryResponse (..),
newPutInventoryResponse,
putInventoryResponse_message,
putInventoryResponse_httpStatus,
)
where
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
import Amazonka.SSM.Types
data PutInventory = PutInventory'
{
PutInventory -> Text
instanceId :: Prelude.Text,
PutInventory -> NonEmpty InventoryItem
items :: Prelude.NonEmpty InventoryItem
}
deriving (PutInventory -> PutInventory -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutInventory -> PutInventory -> Bool
$c/= :: PutInventory -> PutInventory -> Bool
== :: PutInventory -> PutInventory -> Bool
$c== :: PutInventory -> PutInventory -> Bool
Prelude.Eq, ReadPrec [PutInventory]
ReadPrec PutInventory
Int -> ReadS PutInventory
ReadS [PutInventory]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutInventory]
$creadListPrec :: ReadPrec [PutInventory]
readPrec :: ReadPrec PutInventory
$creadPrec :: ReadPrec PutInventory
readList :: ReadS [PutInventory]
$creadList :: ReadS [PutInventory]
readsPrec :: Int -> ReadS PutInventory
$creadsPrec :: Int -> ReadS PutInventory
Prelude.Read, Int -> PutInventory -> ShowS
[PutInventory] -> ShowS
PutInventory -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutInventory] -> ShowS
$cshowList :: [PutInventory] -> ShowS
show :: PutInventory -> String
$cshow :: PutInventory -> String
showsPrec :: Int -> PutInventory -> ShowS
$cshowsPrec :: Int -> PutInventory -> ShowS
Prelude.Show, forall x. Rep PutInventory x -> PutInventory
forall x. PutInventory -> Rep PutInventory x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutInventory x -> PutInventory
$cfrom :: forall x. PutInventory -> Rep PutInventory x
Prelude.Generic)
newPutInventory ::
Prelude.Text ->
Prelude.NonEmpty InventoryItem ->
PutInventory
newPutInventory :: Text -> NonEmpty InventoryItem -> PutInventory
newPutInventory Text
pInstanceId_ NonEmpty InventoryItem
pItems_ =
PutInventory'
{ $sel:instanceId:PutInventory' :: Text
instanceId = Text
pInstanceId_,
$sel:items:PutInventory' :: NonEmpty InventoryItem
items = forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced forall t b. AReview t b -> b -> t
Lens.# NonEmpty InventoryItem
pItems_
}
putInventory_instanceId :: Lens.Lens' PutInventory Prelude.Text
putInventory_instanceId :: Lens' PutInventory Text
putInventory_instanceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutInventory' {Text
instanceId :: Text
$sel:instanceId:PutInventory' :: PutInventory -> Text
instanceId} -> Text
instanceId) (\s :: PutInventory
s@PutInventory' {} Text
a -> PutInventory
s {$sel:instanceId:PutInventory' :: Text
instanceId = Text
a} :: PutInventory)
putInventory_items :: Lens.Lens' PutInventory (Prelude.NonEmpty InventoryItem)
putInventory_items :: Lens' PutInventory (NonEmpty InventoryItem)
putInventory_items = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutInventory' {NonEmpty InventoryItem
items :: NonEmpty InventoryItem
$sel:items:PutInventory' :: PutInventory -> NonEmpty InventoryItem
items} -> NonEmpty InventoryItem
items) (\s :: PutInventory
s@PutInventory' {} NonEmpty InventoryItem
a -> PutInventory
s {$sel:items:PutInventory' :: NonEmpty InventoryItem
items = NonEmpty InventoryItem
a} :: PutInventory) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest PutInventory where
type AWSResponse PutInventory = PutInventoryResponse
request :: (Service -> Service) -> PutInventory -> Request PutInventory
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 PutInventory
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PutInventory)))
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 ->
Maybe Text -> Int -> PutInventoryResponse
PutInventoryResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Message")
forall (f :: * -> *) a b. Applicative f => 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))
)
instance Prelude.Hashable PutInventory where
hashWithSalt :: Int -> PutInventory -> Int
hashWithSalt Int
_salt PutInventory' {NonEmpty InventoryItem
Text
items :: NonEmpty InventoryItem
instanceId :: Text
$sel:items:PutInventory' :: PutInventory -> NonEmpty InventoryItem
$sel:instanceId:PutInventory' :: PutInventory -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
instanceId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty InventoryItem
items
instance Prelude.NFData PutInventory where
rnf :: PutInventory -> ()
rnf PutInventory' {NonEmpty InventoryItem
Text
items :: NonEmpty InventoryItem
instanceId :: Text
$sel:items:PutInventory' :: PutInventory -> NonEmpty InventoryItem
$sel:instanceId:PutInventory' :: PutInventory -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
instanceId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf NonEmpty InventoryItem
items
instance Data.ToHeaders PutInventory where
toHeaders :: PutInventory -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# (ByteString
"AmazonSSM.PutInventory" :: Prelude.ByteString),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON PutInventory where
toJSON :: PutInventory -> Value
toJSON PutInventory' {NonEmpty InventoryItem
Text
items :: NonEmpty InventoryItem
instanceId :: Text
$sel:items:PutInventory' :: PutInventory -> NonEmpty InventoryItem
$sel:instanceId:PutInventory' :: PutInventory -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"InstanceId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
instanceId),
forall a. a -> Maybe a
Prelude.Just (Key
"Items" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NonEmpty InventoryItem
items)
]
)
instance Data.ToPath PutInventory where
toPath :: PutInventory -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery PutInventory where
toQuery :: PutInventory -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data PutInventoryResponse = PutInventoryResponse'
{
PutInventoryResponse -> Maybe Text
message :: Prelude.Maybe Prelude.Text,
PutInventoryResponse -> Int
httpStatus :: Prelude.Int
}
deriving (PutInventoryResponse -> PutInventoryResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutInventoryResponse -> PutInventoryResponse -> Bool
$c/= :: PutInventoryResponse -> PutInventoryResponse -> Bool
== :: PutInventoryResponse -> PutInventoryResponse -> Bool
$c== :: PutInventoryResponse -> PutInventoryResponse -> Bool
Prelude.Eq, ReadPrec [PutInventoryResponse]
ReadPrec PutInventoryResponse
Int -> ReadS PutInventoryResponse
ReadS [PutInventoryResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutInventoryResponse]
$creadListPrec :: ReadPrec [PutInventoryResponse]
readPrec :: ReadPrec PutInventoryResponse
$creadPrec :: ReadPrec PutInventoryResponse
readList :: ReadS [PutInventoryResponse]
$creadList :: ReadS [PutInventoryResponse]
readsPrec :: Int -> ReadS PutInventoryResponse
$creadsPrec :: Int -> ReadS PutInventoryResponse
Prelude.Read, Int -> PutInventoryResponse -> ShowS
[PutInventoryResponse] -> ShowS
PutInventoryResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutInventoryResponse] -> ShowS
$cshowList :: [PutInventoryResponse] -> ShowS
show :: PutInventoryResponse -> String
$cshow :: PutInventoryResponse -> String
showsPrec :: Int -> PutInventoryResponse -> ShowS
$cshowsPrec :: Int -> PutInventoryResponse -> ShowS
Prelude.Show, forall x. Rep PutInventoryResponse x -> PutInventoryResponse
forall x. PutInventoryResponse -> Rep PutInventoryResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutInventoryResponse x -> PutInventoryResponse
$cfrom :: forall x. PutInventoryResponse -> Rep PutInventoryResponse x
Prelude.Generic)
newPutInventoryResponse ::
Prelude.Int ->
PutInventoryResponse
newPutInventoryResponse :: Int -> PutInventoryResponse
newPutInventoryResponse Int
pHttpStatus_ =
PutInventoryResponse'
{ $sel:message:PutInventoryResponse' :: Maybe Text
message = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:PutInventoryResponse' :: Int
httpStatus = Int
pHttpStatus_
}
putInventoryResponse_message :: Lens.Lens' PutInventoryResponse (Prelude.Maybe Prelude.Text)
putInventoryResponse_message :: Lens' PutInventoryResponse (Maybe Text)
putInventoryResponse_message = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutInventoryResponse' {Maybe Text
message :: Maybe Text
$sel:message:PutInventoryResponse' :: PutInventoryResponse -> Maybe Text
message} -> Maybe Text
message) (\s :: PutInventoryResponse
s@PutInventoryResponse' {} Maybe Text
a -> PutInventoryResponse
s {$sel:message:PutInventoryResponse' :: Maybe Text
message = Maybe Text
a} :: PutInventoryResponse)
putInventoryResponse_httpStatus :: Lens.Lens' PutInventoryResponse Prelude.Int
putInventoryResponse_httpStatus :: Lens' PutInventoryResponse Int
putInventoryResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutInventoryResponse' {Int
httpStatus :: Int
$sel:httpStatus:PutInventoryResponse' :: PutInventoryResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: PutInventoryResponse
s@PutInventoryResponse' {} Int
a -> PutInventoryResponse
s {$sel:httpStatus:PutInventoryResponse' :: Int
httpStatus = Int
a} :: PutInventoryResponse)
instance Prelude.NFData PutInventoryResponse where
rnf :: PutInventoryResponse -> ()
rnf PutInventoryResponse' {Int
Maybe Text
httpStatus :: Int
message :: Maybe Text
$sel:httpStatus:PutInventoryResponse' :: PutInventoryResponse -> Int
$sel:message:PutInventoryResponse' :: PutInventoryResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
message
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus