{-# 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.SageMaker.AddAssociation
(
AddAssociation (..),
newAddAssociation,
addAssociation_associationType,
addAssociation_sourceArn,
addAssociation_destinationArn,
AddAssociationResponse (..),
newAddAssociationResponse,
addAssociationResponse_sourceArn,
addAssociationResponse_destinationArn,
addAssociationResponse_httpStatus,
)
where
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
import Amazonka.SageMaker.Types
data AddAssociation = AddAssociation'
{
AddAssociation -> Maybe AssociationEdgeType
associationType :: Prelude.Maybe AssociationEdgeType,
AddAssociation -> Text
sourceArn :: Prelude.Text,
AddAssociation -> Text
destinationArn :: Prelude.Text
}
deriving (AddAssociation -> AddAssociation -> Bool
(AddAssociation -> AddAssociation -> Bool)
-> (AddAssociation -> AddAssociation -> Bool) -> Eq AddAssociation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AddAssociation -> AddAssociation -> Bool
$c/= :: AddAssociation -> AddAssociation -> Bool
== :: AddAssociation -> AddAssociation -> Bool
$c== :: AddAssociation -> AddAssociation -> Bool
Prelude.Eq, ReadPrec [AddAssociation]
ReadPrec AddAssociation
Int -> ReadS AddAssociation
ReadS [AddAssociation]
(Int -> ReadS AddAssociation)
-> ReadS [AddAssociation]
-> ReadPrec AddAssociation
-> ReadPrec [AddAssociation]
-> Read AddAssociation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AddAssociation]
$creadListPrec :: ReadPrec [AddAssociation]
readPrec :: ReadPrec AddAssociation
$creadPrec :: ReadPrec AddAssociation
readList :: ReadS [AddAssociation]
$creadList :: ReadS [AddAssociation]
readsPrec :: Int -> ReadS AddAssociation
$creadsPrec :: Int -> ReadS AddAssociation
Prelude.Read, Int -> AddAssociation -> ShowS
[AddAssociation] -> ShowS
AddAssociation -> String
(Int -> AddAssociation -> ShowS)
-> (AddAssociation -> String)
-> ([AddAssociation] -> ShowS)
-> Show AddAssociation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AddAssociation] -> ShowS
$cshowList :: [AddAssociation] -> ShowS
show :: AddAssociation -> String
$cshow :: AddAssociation -> String
showsPrec :: Int -> AddAssociation -> ShowS
$cshowsPrec :: Int -> AddAssociation -> ShowS
Prelude.Show, (forall x. AddAssociation -> Rep AddAssociation x)
-> (forall x. Rep AddAssociation x -> AddAssociation)
-> Generic AddAssociation
forall x. Rep AddAssociation x -> AddAssociation
forall x. AddAssociation -> Rep AddAssociation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AddAssociation x -> AddAssociation
$cfrom :: forall x. AddAssociation -> Rep AddAssociation x
Prelude.Generic)
newAddAssociation ::
Prelude.Text ->
Prelude.Text ->
AddAssociation
newAddAssociation :: Text -> Text -> AddAssociation
newAddAssociation Text
pSourceArn_ Text
pDestinationArn_ =
AddAssociation' :: Maybe AssociationEdgeType -> Text -> Text -> AddAssociation
AddAssociation'
{ $sel:associationType:AddAssociation' :: Maybe AssociationEdgeType
associationType = Maybe AssociationEdgeType
forall a. Maybe a
Prelude.Nothing,
$sel:sourceArn:AddAssociation' :: Text
sourceArn = Text
pSourceArn_,
$sel:destinationArn:AddAssociation' :: Text
destinationArn = Text
pDestinationArn_
}
addAssociation_associationType :: Lens.Lens' AddAssociation (Prelude.Maybe AssociationEdgeType)
addAssociation_associationType :: (Maybe AssociationEdgeType -> f (Maybe AssociationEdgeType))
-> AddAssociation -> f AddAssociation
addAssociation_associationType = (AddAssociation -> Maybe AssociationEdgeType)
-> (AddAssociation -> Maybe AssociationEdgeType -> AddAssociation)
-> Lens
AddAssociation
AddAssociation
(Maybe AssociationEdgeType)
(Maybe AssociationEdgeType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddAssociation' {Maybe AssociationEdgeType
associationType :: Maybe AssociationEdgeType
$sel:associationType:AddAssociation' :: AddAssociation -> Maybe AssociationEdgeType
associationType} -> Maybe AssociationEdgeType
associationType) (\s :: AddAssociation
s@AddAssociation' {} Maybe AssociationEdgeType
a -> AddAssociation
s {$sel:associationType:AddAssociation' :: Maybe AssociationEdgeType
associationType = Maybe AssociationEdgeType
a} :: AddAssociation)
addAssociation_sourceArn :: Lens.Lens' AddAssociation Prelude.Text
addAssociation_sourceArn :: (Text -> f Text) -> AddAssociation -> f AddAssociation
addAssociation_sourceArn = (AddAssociation -> Text)
-> (AddAssociation -> Text -> AddAssociation)
-> Lens AddAssociation AddAssociation Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddAssociation' {Text
sourceArn :: Text
$sel:sourceArn:AddAssociation' :: AddAssociation -> Text
sourceArn} -> Text
sourceArn) (\s :: AddAssociation
s@AddAssociation' {} Text
a -> AddAssociation
s {$sel:sourceArn:AddAssociation' :: Text
sourceArn = Text
a} :: AddAssociation)
addAssociation_destinationArn :: Lens.Lens' AddAssociation Prelude.Text
addAssociation_destinationArn :: (Text -> f Text) -> AddAssociation -> f AddAssociation
addAssociation_destinationArn = (AddAssociation -> Text)
-> (AddAssociation -> Text -> AddAssociation)
-> Lens AddAssociation AddAssociation Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddAssociation' {Text
destinationArn :: Text
$sel:destinationArn:AddAssociation' :: AddAssociation -> Text
destinationArn} -> Text
destinationArn) (\s :: AddAssociation
s@AddAssociation' {} Text
a -> AddAssociation
s {$sel:destinationArn:AddAssociation' :: Text
destinationArn = Text
a} :: AddAssociation)
instance Core.AWSRequest AddAssociation where
type
AWSResponse AddAssociation =
AddAssociationResponse
request :: AddAssociation -> Request AddAssociation
request = Service -> AddAssociation -> Request AddAssociation
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy AddAssociation
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse AddAssociation)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse AddAssociation))
-> Logger
-> Service
-> Proxy AddAssociation
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse AddAssociation)))
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 ->
Maybe Text -> Maybe Text -> Int -> AddAssociationResponse
AddAssociationResponse'
(Maybe Text -> Maybe Text -> Int -> AddAssociationResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> AddAssociationResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"SourceArn")
Either String (Maybe Text -> Int -> AddAssociationResponse)
-> Either String (Maybe Text)
-> Either String (Int -> AddAssociationResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"DestinationArn")
Either String (Int -> AddAssociationResponse)
-> Either String Int -> Either String AddAssociationResponse
forall (f :: * -> *) a b. Applicative f => 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))
)
instance Prelude.Hashable AddAssociation
instance Prelude.NFData AddAssociation
instance Core.ToHeaders AddAssociation where
toHeaders :: AddAssociation -> ResponseHeaders
toHeaders =
ResponseHeaders -> AddAssociation -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# (ByteString
"SageMaker.AddAssociation" :: Prelude.ByteString),
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 AddAssociation where
toJSON :: AddAssociation -> Value
toJSON AddAssociation' {Maybe AssociationEdgeType
Text
destinationArn :: Text
sourceArn :: Text
associationType :: Maybe AssociationEdgeType
$sel:destinationArn:AddAssociation' :: AddAssociation -> Text
$sel:sourceArn:AddAssociation' :: AddAssociation -> Text
$sel:associationType:AddAssociation' :: AddAssociation -> Maybe AssociationEdgeType
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"AssociationType" Text -> AssociationEdgeType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(AssociationEdgeType -> Pair)
-> Maybe AssociationEdgeType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AssociationEdgeType
associationType,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"SourceArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
sourceArn),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"DestinationArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
destinationArn)
]
)
instance Core.ToPath AddAssociation where
toPath :: AddAssociation -> ByteString
toPath = ByteString -> AddAssociation -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery AddAssociation where
toQuery :: AddAssociation -> QueryString
toQuery = QueryString -> AddAssociation -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data AddAssociationResponse = AddAssociationResponse'
{
AddAssociationResponse -> Maybe Text
sourceArn :: Prelude.Maybe Prelude.Text,
AddAssociationResponse -> Maybe Text
destinationArn :: Prelude.Maybe Prelude.Text,
AddAssociationResponse -> Int
httpStatus :: Prelude.Int
}
deriving (AddAssociationResponse -> AddAssociationResponse -> Bool
(AddAssociationResponse -> AddAssociationResponse -> Bool)
-> (AddAssociationResponse -> AddAssociationResponse -> Bool)
-> Eq AddAssociationResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AddAssociationResponse -> AddAssociationResponse -> Bool
$c/= :: AddAssociationResponse -> AddAssociationResponse -> Bool
== :: AddAssociationResponse -> AddAssociationResponse -> Bool
$c== :: AddAssociationResponse -> AddAssociationResponse -> Bool
Prelude.Eq, ReadPrec [AddAssociationResponse]
ReadPrec AddAssociationResponse
Int -> ReadS AddAssociationResponse
ReadS [AddAssociationResponse]
(Int -> ReadS AddAssociationResponse)
-> ReadS [AddAssociationResponse]
-> ReadPrec AddAssociationResponse
-> ReadPrec [AddAssociationResponse]
-> Read AddAssociationResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AddAssociationResponse]
$creadListPrec :: ReadPrec [AddAssociationResponse]
readPrec :: ReadPrec AddAssociationResponse
$creadPrec :: ReadPrec AddAssociationResponse
readList :: ReadS [AddAssociationResponse]
$creadList :: ReadS [AddAssociationResponse]
readsPrec :: Int -> ReadS AddAssociationResponse
$creadsPrec :: Int -> ReadS AddAssociationResponse
Prelude.Read, Int -> AddAssociationResponse -> ShowS
[AddAssociationResponse] -> ShowS
AddAssociationResponse -> String
(Int -> AddAssociationResponse -> ShowS)
-> (AddAssociationResponse -> String)
-> ([AddAssociationResponse] -> ShowS)
-> Show AddAssociationResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AddAssociationResponse] -> ShowS
$cshowList :: [AddAssociationResponse] -> ShowS
show :: AddAssociationResponse -> String
$cshow :: AddAssociationResponse -> String
showsPrec :: Int -> AddAssociationResponse -> ShowS
$cshowsPrec :: Int -> AddAssociationResponse -> ShowS
Prelude.Show, (forall x. AddAssociationResponse -> Rep AddAssociationResponse x)
-> (forall x.
Rep AddAssociationResponse x -> AddAssociationResponse)
-> Generic AddAssociationResponse
forall x. Rep AddAssociationResponse x -> AddAssociationResponse
forall x. AddAssociationResponse -> Rep AddAssociationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AddAssociationResponse x -> AddAssociationResponse
$cfrom :: forall x. AddAssociationResponse -> Rep AddAssociationResponse x
Prelude.Generic)
newAddAssociationResponse ::
Prelude.Int ->
AddAssociationResponse
newAddAssociationResponse :: Int -> AddAssociationResponse
newAddAssociationResponse Int
pHttpStatus_ =
AddAssociationResponse' :: Maybe Text -> Maybe Text -> Int -> AddAssociationResponse
AddAssociationResponse'
{ $sel:sourceArn:AddAssociationResponse' :: Maybe Text
sourceArn =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:destinationArn:AddAssociationResponse' :: Maybe Text
destinationArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:AddAssociationResponse' :: Int
httpStatus = Int
pHttpStatus_
}
addAssociationResponse_sourceArn :: Lens.Lens' AddAssociationResponse (Prelude.Maybe Prelude.Text)
addAssociationResponse_sourceArn :: (Maybe Text -> f (Maybe Text))
-> AddAssociationResponse -> f AddAssociationResponse
addAssociationResponse_sourceArn = (AddAssociationResponse -> Maybe Text)
-> (AddAssociationResponse -> Maybe Text -> AddAssociationResponse)
-> Lens
AddAssociationResponse
AddAssociationResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddAssociationResponse' {Maybe Text
sourceArn :: Maybe Text
$sel:sourceArn:AddAssociationResponse' :: AddAssociationResponse -> Maybe Text
sourceArn} -> Maybe Text
sourceArn) (\s :: AddAssociationResponse
s@AddAssociationResponse' {} Maybe Text
a -> AddAssociationResponse
s {$sel:sourceArn:AddAssociationResponse' :: Maybe Text
sourceArn = Maybe Text
a} :: AddAssociationResponse)
addAssociationResponse_destinationArn :: Lens.Lens' AddAssociationResponse (Prelude.Maybe Prelude.Text)
addAssociationResponse_destinationArn :: (Maybe Text -> f (Maybe Text))
-> AddAssociationResponse -> f AddAssociationResponse
addAssociationResponse_destinationArn = (AddAssociationResponse -> Maybe Text)
-> (AddAssociationResponse -> Maybe Text -> AddAssociationResponse)
-> Lens
AddAssociationResponse
AddAssociationResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddAssociationResponse' {Maybe Text
destinationArn :: Maybe Text
$sel:destinationArn:AddAssociationResponse' :: AddAssociationResponse -> Maybe Text
destinationArn} -> Maybe Text
destinationArn) (\s :: AddAssociationResponse
s@AddAssociationResponse' {} Maybe Text
a -> AddAssociationResponse
s {$sel:destinationArn:AddAssociationResponse' :: Maybe Text
destinationArn = Maybe Text
a} :: AddAssociationResponse)
addAssociationResponse_httpStatus :: Lens.Lens' AddAssociationResponse Prelude.Int
addAssociationResponse_httpStatus :: (Int -> f Int)
-> AddAssociationResponse -> f AddAssociationResponse
addAssociationResponse_httpStatus = (AddAssociationResponse -> Int)
-> (AddAssociationResponse -> Int -> AddAssociationResponse)
-> Lens AddAssociationResponse AddAssociationResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddAssociationResponse' {Int
httpStatus :: Int
$sel:httpStatus:AddAssociationResponse' :: AddAssociationResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AddAssociationResponse
s@AddAssociationResponse' {} Int
a -> AddAssociationResponse
s {$sel:httpStatus:AddAssociationResponse' :: Int
httpStatus = Int
a} :: AddAssociationResponse)
instance Prelude.NFData AddAssociationResponse