{-# 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.OpsWorks.AssignVolume
(
AssignVolume (..),
newAssignVolume,
assignVolume_instanceId,
assignVolume_volumeId,
AssignVolumeResponse (..),
newAssignVolumeResponse,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.OpsWorks.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data AssignVolume = AssignVolume'
{
AssignVolume -> Maybe Text
instanceId :: Prelude.Maybe Prelude.Text,
AssignVolume -> Text
volumeId :: Prelude.Text
}
deriving (AssignVolume -> AssignVolume -> Bool
(AssignVolume -> AssignVolume -> Bool)
-> (AssignVolume -> AssignVolume -> Bool) -> Eq AssignVolume
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssignVolume -> AssignVolume -> Bool
$c/= :: AssignVolume -> AssignVolume -> Bool
== :: AssignVolume -> AssignVolume -> Bool
$c== :: AssignVolume -> AssignVolume -> Bool
Prelude.Eq, ReadPrec [AssignVolume]
ReadPrec AssignVolume
Int -> ReadS AssignVolume
ReadS [AssignVolume]
(Int -> ReadS AssignVolume)
-> ReadS [AssignVolume]
-> ReadPrec AssignVolume
-> ReadPrec [AssignVolume]
-> Read AssignVolume
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssignVolume]
$creadListPrec :: ReadPrec [AssignVolume]
readPrec :: ReadPrec AssignVolume
$creadPrec :: ReadPrec AssignVolume
readList :: ReadS [AssignVolume]
$creadList :: ReadS [AssignVolume]
readsPrec :: Int -> ReadS AssignVolume
$creadsPrec :: Int -> ReadS AssignVolume
Prelude.Read, Int -> AssignVolume -> ShowS
[AssignVolume] -> ShowS
AssignVolume -> String
(Int -> AssignVolume -> ShowS)
-> (AssignVolume -> String)
-> ([AssignVolume] -> ShowS)
-> Show AssignVolume
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssignVolume] -> ShowS
$cshowList :: [AssignVolume] -> ShowS
show :: AssignVolume -> String
$cshow :: AssignVolume -> String
showsPrec :: Int -> AssignVolume -> ShowS
$cshowsPrec :: Int -> AssignVolume -> ShowS
Prelude.Show, (forall x. AssignVolume -> Rep AssignVolume x)
-> (forall x. Rep AssignVolume x -> AssignVolume)
-> Generic AssignVolume
forall x. Rep AssignVolume x -> AssignVolume
forall x. AssignVolume -> Rep AssignVolume x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AssignVolume x -> AssignVolume
$cfrom :: forall x. AssignVolume -> Rep AssignVolume x
Prelude.Generic)
newAssignVolume ::
Prelude.Text ->
AssignVolume
newAssignVolume :: Text -> AssignVolume
newAssignVolume Text
pVolumeId_ =
AssignVolume' :: Maybe Text -> Text -> AssignVolume
AssignVolume'
{ $sel:instanceId:AssignVolume' :: Maybe Text
instanceId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:volumeId:AssignVolume' :: Text
volumeId = Text
pVolumeId_
}
assignVolume_instanceId :: Lens.Lens' AssignVolume (Prelude.Maybe Prelude.Text)
assignVolume_instanceId :: (Maybe Text -> f (Maybe Text)) -> AssignVolume -> f AssignVolume
assignVolume_instanceId = (AssignVolume -> Maybe Text)
-> (AssignVolume -> Maybe Text -> AssignVolume)
-> Lens AssignVolume AssignVolume (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssignVolume' {Maybe Text
instanceId :: Maybe Text
$sel:instanceId:AssignVolume' :: AssignVolume -> Maybe Text
instanceId} -> Maybe Text
instanceId) (\s :: AssignVolume
s@AssignVolume' {} Maybe Text
a -> AssignVolume
s {$sel:instanceId:AssignVolume' :: Maybe Text
instanceId = Maybe Text
a} :: AssignVolume)
assignVolume_volumeId :: Lens.Lens' AssignVolume Prelude.Text
assignVolume_volumeId :: (Text -> f Text) -> AssignVolume -> f AssignVolume
assignVolume_volumeId = (AssignVolume -> Text)
-> (AssignVolume -> Text -> AssignVolume)
-> Lens AssignVolume AssignVolume Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssignVolume' {Text
volumeId :: Text
$sel:volumeId:AssignVolume' :: AssignVolume -> Text
volumeId} -> Text
volumeId) (\s :: AssignVolume
s@AssignVolume' {} Text
a -> AssignVolume
s {$sel:volumeId:AssignVolume' :: Text
volumeId = Text
a} :: AssignVolume)
instance Core.AWSRequest AssignVolume where
type AWSResponse AssignVolume = AssignVolumeResponse
request :: AssignVolume -> Request AssignVolume
request = Service -> AssignVolume -> Request AssignVolume
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy AssignVolume
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse AssignVolume)))
response = AWSResponse AssignVolume
-> Logger
-> Service
-> Proxy AssignVolume
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse AssignVolume)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse AssignVolume
AssignVolumeResponse
AssignVolumeResponse'
instance Prelude.Hashable AssignVolume
instance Prelude.NFData AssignVolume
instance Core.ToHeaders AssignVolume where
toHeaders :: AssignVolume -> [Header]
toHeaders =
[Header] -> AssignVolume -> [Header]
forall a b. a -> b -> a
Prelude.const
( [[Header]] -> [Header]
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"OpsWorks_20130218.AssignVolume" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON AssignVolume where
toJSON :: AssignVolume -> Value
toJSON AssignVolume' {Maybe Text
Text
volumeId :: Text
instanceId :: Maybe Text
$sel:volumeId:AssignVolume' :: AssignVolume -> Text
$sel:instanceId:AssignVolume' :: AssignVolume -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"InstanceId" 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
instanceId,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"VolumeId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
volumeId)
]
)
instance Core.ToPath AssignVolume where
toPath :: AssignVolume -> ByteString
toPath = ByteString -> AssignVolume -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery AssignVolume where
toQuery :: AssignVolume -> QueryString
toQuery = QueryString -> AssignVolume -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data AssignVolumeResponse = AssignVolumeResponse'
{
}
deriving (AssignVolumeResponse -> AssignVolumeResponse -> Bool
(AssignVolumeResponse -> AssignVolumeResponse -> Bool)
-> (AssignVolumeResponse -> AssignVolumeResponse -> Bool)
-> Eq AssignVolumeResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssignVolumeResponse -> AssignVolumeResponse -> Bool
$c/= :: AssignVolumeResponse -> AssignVolumeResponse -> Bool
== :: AssignVolumeResponse -> AssignVolumeResponse -> Bool
$c== :: AssignVolumeResponse -> AssignVolumeResponse -> Bool
Prelude.Eq, ReadPrec [AssignVolumeResponse]
ReadPrec AssignVolumeResponse
Int -> ReadS AssignVolumeResponse
ReadS [AssignVolumeResponse]
(Int -> ReadS AssignVolumeResponse)
-> ReadS [AssignVolumeResponse]
-> ReadPrec AssignVolumeResponse
-> ReadPrec [AssignVolumeResponse]
-> Read AssignVolumeResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssignVolumeResponse]
$creadListPrec :: ReadPrec [AssignVolumeResponse]
readPrec :: ReadPrec AssignVolumeResponse
$creadPrec :: ReadPrec AssignVolumeResponse
readList :: ReadS [AssignVolumeResponse]
$creadList :: ReadS [AssignVolumeResponse]
readsPrec :: Int -> ReadS AssignVolumeResponse
$creadsPrec :: Int -> ReadS AssignVolumeResponse
Prelude.Read, Int -> AssignVolumeResponse -> ShowS
[AssignVolumeResponse] -> ShowS
AssignVolumeResponse -> String
(Int -> AssignVolumeResponse -> ShowS)
-> (AssignVolumeResponse -> String)
-> ([AssignVolumeResponse] -> ShowS)
-> Show AssignVolumeResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssignVolumeResponse] -> ShowS
$cshowList :: [AssignVolumeResponse] -> ShowS
show :: AssignVolumeResponse -> String
$cshow :: AssignVolumeResponse -> String
showsPrec :: Int -> AssignVolumeResponse -> ShowS
$cshowsPrec :: Int -> AssignVolumeResponse -> ShowS
Prelude.Show, (forall x. AssignVolumeResponse -> Rep AssignVolumeResponse x)
-> (forall x. Rep AssignVolumeResponse x -> AssignVolumeResponse)
-> Generic AssignVolumeResponse
forall x. Rep AssignVolumeResponse x -> AssignVolumeResponse
forall x. AssignVolumeResponse -> Rep AssignVolumeResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AssignVolumeResponse x -> AssignVolumeResponse
$cfrom :: forall x. AssignVolumeResponse -> Rep AssignVolumeResponse x
Prelude.Generic)
newAssignVolumeResponse ::
AssignVolumeResponse
newAssignVolumeResponse :: AssignVolumeResponse
newAssignVolumeResponse = AssignVolumeResponse
AssignVolumeResponse'
instance Prelude.NFData AssignVolumeResponse