{-# 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.BackupGateway.AssociateGatewayToServer
(
AssociateGatewayToServer (..),
newAssociateGatewayToServer,
associateGatewayToServer_gatewayArn,
associateGatewayToServer_serverArn,
AssociateGatewayToServerResponse (..),
newAssociateGatewayToServerResponse,
associateGatewayToServerResponse_gatewayArn,
associateGatewayToServerResponse_httpStatus,
)
where
import Amazonka.BackupGateway.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 AssociateGatewayToServer = AssociateGatewayToServer'
{
AssociateGatewayToServer -> Text
gatewayArn :: Prelude.Text,
AssociateGatewayToServer -> Text
serverArn :: Prelude.Text
}
deriving (AssociateGatewayToServer -> AssociateGatewayToServer -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociateGatewayToServer -> AssociateGatewayToServer -> Bool
$c/= :: AssociateGatewayToServer -> AssociateGatewayToServer -> Bool
== :: AssociateGatewayToServer -> AssociateGatewayToServer -> Bool
$c== :: AssociateGatewayToServer -> AssociateGatewayToServer -> Bool
Prelude.Eq, ReadPrec [AssociateGatewayToServer]
ReadPrec AssociateGatewayToServer
Int -> ReadS AssociateGatewayToServer
ReadS [AssociateGatewayToServer]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssociateGatewayToServer]
$creadListPrec :: ReadPrec [AssociateGatewayToServer]
readPrec :: ReadPrec AssociateGatewayToServer
$creadPrec :: ReadPrec AssociateGatewayToServer
readList :: ReadS [AssociateGatewayToServer]
$creadList :: ReadS [AssociateGatewayToServer]
readsPrec :: Int -> ReadS AssociateGatewayToServer
$creadsPrec :: Int -> ReadS AssociateGatewayToServer
Prelude.Read, Int -> AssociateGatewayToServer -> ShowS
[AssociateGatewayToServer] -> ShowS
AssociateGatewayToServer -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociateGatewayToServer] -> ShowS
$cshowList :: [AssociateGatewayToServer] -> ShowS
show :: AssociateGatewayToServer -> String
$cshow :: AssociateGatewayToServer -> String
showsPrec :: Int -> AssociateGatewayToServer -> ShowS
$cshowsPrec :: Int -> AssociateGatewayToServer -> ShowS
Prelude.Show, forall x.
Rep AssociateGatewayToServer x -> AssociateGatewayToServer
forall x.
AssociateGatewayToServer -> Rep AssociateGatewayToServer x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AssociateGatewayToServer x -> AssociateGatewayToServer
$cfrom :: forall x.
AssociateGatewayToServer -> Rep AssociateGatewayToServer x
Prelude.Generic)
newAssociateGatewayToServer ::
Prelude.Text ->
Prelude.Text ->
AssociateGatewayToServer
newAssociateGatewayToServer :: Text -> Text -> AssociateGatewayToServer
newAssociateGatewayToServer Text
pGatewayArn_ Text
pServerArn_ =
AssociateGatewayToServer'
{ $sel:gatewayArn:AssociateGatewayToServer' :: Text
gatewayArn =
Text
pGatewayArn_,
$sel:serverArn:AssociateGatewayToServer' :: Text
serverArn = Text
pServerArn_
}
associateGatewayToServer_gatewayArn :: Lens.Lens' AssociateGatewayToServer Prelude.Text
associateGatewayToServer_gatewayArn :: Lens' AssociateGatewayToServer Text
associateGatewayToServer_gatewayArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateGatewayToServer' {Text
gatewayArn :: Text
$sel:gatewayArn:AssociateGatewayToServer' :: AssociateGatewayToServer -> Text
gatewayArn} -> Text
gatewayArn) (\s :: AssociateGatewayToServer
s@AssociateGatewayToServer' {} Text
a -> AssociateGatewayToServer
s {$sel:gatewayArn:AssociateGatewayToServer' :: Text
gatewayArn = Text
a} :: AssociateGatewayToServer)
associateGatewayToServer_serverArn :: Lens.Lens' AssociateGatewayToServer Prelude.Text
associateGatewayToServer_serverArn :: Lens' AssociateGatewayToServer Text
associateGatewayToServer_serverArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateGatewayToServer' {Text
serverArn :: Text
$sel:serverArn:AssociateGatewayToServer' :: AssociateGatewayToServer -> Text
serverArn} -> Text
serverArn) (\s :: AssociateGatewayToServer
s@AssociateGatewayToServer' {} Text
a -> AssociateGatewayToServer
s {$sel:serverArn:AssociateGatewayToServer' :: Text
serverArn = Text
a} :: AssociateGatewayToServer)
instance Core.AWSRequest AssociateGatewayToServer where
type
AWSResponse AssociateGatewayToServer =
AssociateGatewayToServerResponse
request :: (Service -> Service)
-> AssociateGatewayToServer -> Request AssociateGatewayToServer
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 AssociateGatewayToServer
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AssociateGatewayToServer)))
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 -> AssociateGatewayToServerResponse
AssociateGatewayToServerResponse'
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
"GatewayArn")
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 AssociateGatewayToServer where
hashWithSalt :: Int -> AssociateGatewayToServer -> Int
hashWithSalt Int
_salt AssociateGatewayToServer' {Text
serverArn :: Text
gatewayArn :: Text
$sel:serverArn:AssociateGatewayToServer' :: AssociateGatewayToServer -> Text
$sel:gatewayArn:AssociateGatewayToServer' :: AssociateGatewayToServer -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
gatewayArn
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
serverArn
instance Prelude.NFData AssociateGatewayToServer where
rnf :: AssociateGatewayToServer -> ()
rnf AssociateGatewayToServer' {Text
serverArn :: Text
gatewayArn :: Text
$sel:serverArn:AssociateGatewayToServer' :: AssociateGatewayToServer -> Text
$sel:gatewayArn:AssociateGatewayToServer' :: AssociateGatewayToServer -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
gatewayArn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
serverArn
instance Data.ToHeaders AssociateGatewayToServer where
toHeaders :: AssociateGatewayToServer -> 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
"BackupOnPremises_v20210101.AssociateGatewayToServer" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.0" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON AssociateGatewayToServer where
toJSON :: AssociateGatewayToServer -> Value
toJSON AssociateGatewayToServer' {Text
serverArn :: Text
gatewayArn :: Text
$sel:serverArn:AssociateGatewayToServer' :: AssociateGatewayToServer -> Text
$sel:gatewayArn:AssociateGatewayToServer' :: AssociateGatewayToServer -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"GatewayArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
gatewayArn),
forall a. a -> Maybe a
Prelude.Just (Key
"ServerArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
serverArn)
]
)
instance Data.ToPath AssociateGatewayToServer where
toPath :: AssociateGatewayToServer -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery AssociateGatewayToServer where
toQuery :: AssociateGatewayToServer -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data AssociateGatewayToServerResponse = AssociateGatewayToServerResponse'
{
AssociateGatewayToServerResponse -> Maybe Text
gatewayArn :: Prelude.Maybe Prelude.Text,
AssociateGatewayToServerResponse -> Int
httpStatus :: Prelude.Int
}
deriving (AssociateGatewayToServerResponse
-> AssociateGatewayToServerResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociateGatewayToServerResponse
-> AssociateGatewayToServerResponse -> Bool
$c/= :: AssociateGatewayToServerResponse
-> AssociateGatewayToServerResponse -> Bool
== :: AssociateGatewayToServerResponse
-> AssociateGatewayToServerResponse -> Bool
$c== :: AssociateGatewayToServerResponse
-> AssociateGatewayToServerResponse -> Bool
Prelude.Eq, ReadPrec [AssociateGatewayToServerResponse]
ReadPrec AssociateGatewayToServerResponse
Int -> ReadS AssociateGatewayToServerResponse
ReadS [AssociateGatewayToServerResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssociateGatewayToServerResponse]
$creadListPrec :: ReadPrec [AssociateGatewayToServerResponse]
readPrec :: ReadPrec AssociateGatewayToServerResponse
$creadPrec :: ReadPrec AssociateGatewayToServerResponse
readList :: ReadS [AssociateGatewayToServerResponse]
$creadList :: ReadS [AssociateGatewayToServerResponse]
readsPrec :: Int -> ReadS AssociateGatewayToServerResponse
$creadsPrec :: Int -> ReadS AssociateGatewayToServerResponse
Prelude.Read, Int -> AssociateGatewayToServerResponse -> ShowS
[AssociateGatewayToServerResponse] -> ShowS
AssociateGatewayToServerResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociateGatewayToServerResponse] -> ShowS
$cshowList :: [AssociateGatewayToServerResponse] -> ShowS
show :: AssociateGatewayToServerResponse -> String
$cshow :: AssociateGatewayToServerResponse -> String
showsPrec :: Int -> AssociateGatewayToServerResponse -> ShowS
$cshowsPrec :: Int -> AssociateGatewayToServerResponse -> ShowS
Prelude.Show, forall x.
Rep AssociateGatewayToServerResponse x
-> AssociateGatewayToServerResponse
forall x.
AssociateGatewayToServerResponse
-> Rep AssociateGatewayToServerResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AssociateGatewayToServerResponse x
-> AssociateGatewayToServerResponse
$cfrom :: forall x.
AssociateGatewayToServerResponse
-> Rep AssociateGatewayToServerResponse x
Prelude.Generic)
newAssociateGatewayToServerResponse ::
Prelude.Int ->
AssociateGatewayToServerResponse
newAssociateGatewayToServerResponse :: Int -> AssociateGatewayToServerResponse
newAssociateGatewayToServerResponse Int
pHttpStatus_ =
AssociateGatewayToServerResponse'
{ $sel:gatewayArn:AssociateGatewayToServerResponse' :: Maybe Text
gatewayArn =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:AssociateGatewayToServerResponse' :: Int
httpStatus = Int
pHttpStatus_
}
associateGatewayToServerResponse_gatewayArn :: Lens.Lens' AssociateGatewayToServerResponse (Prelude.Maybe Prelude.Text)
associateGatewayToServerResponse_gatewayArn :: Lens' AssociateGatewayToServerResponse (Maybe Text)
associateGatewayToServerResponse_gatewayArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateGatewayToServerResponse' {Maybe Text
gatewayArn :: Maybe Text
$sel:gatewayArn:AssociateGatewayToServerResponse' :: AssociateGatewayToServerResponse -> Maybe Text
gatewayArn} -> Maybe Text
gatewayArn) (\s :: AssociateGatewayToServerResponse
s@AssociateGatewayToServerResponse' {} Maybe Text
a -> AssociateGatewayToServerResponse
s {$sel:gatewayArn:AssociateGatewayToServerResponse' :: Maybe Text
gatewayArn = Maybe Text
a} :: AssociateGatewayToServerResponse)
associateGatewayToServerResponse_httpStatus :: Lens.Lens' AssociateGatewayToServerResponse Prelude.Int
associateGatewayToServerResponse_httpStatus :: Lens' AssociateGatewayToServerResponse Int
associateGatewayToServerResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateGatewayToServerResponse' {Int
httpStatus :: Int
$sel:httpStatus:AssociateGatewayToServerResponse' :: AssociateGatewayToServerResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AssociateGatewayToServerResponse
s@AssociateGatewayToServerResponse' {} Int
a -> AssociateGatewayToServerResponse
s {$sel:httpStatus:AssociateGatewayToServerResponse' :: Int
httpStatus = Int
a} :: AssociateGatewayToServerResponse)
instance
Prelude.NFData
AssociateGatewayToServerResponse
where
rnf :: AssociateGatewayToServerResponse -> ()
rnf AssociateGatewayToServerResponse' {Int
Maybe Text
httpStatus :: Int
gatewayArn :: Maybe Text
$sel:httpStatus:AssociateGatewayToServerResponse' :: AssociateGatewayToServerResponse -> Int
$sel:gatewayArn:AssociateGatewayToServerResponse' :: AssociateGatewayToServerResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
gatewayArn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus