{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.SageMaker.DeleteAssociation
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Deletes an association.
module Amazonka.SageMaker.DeleteAssociation
  ( -- * Creating a Request
    DeleteAssociation (..),
    newDeleteAssociation,

    -- * Request Lenses
    deleteAssociation_sourceArn,
    deleteAssociation_destinationArn,

    -- * Destructuring the Response
    DeleteAssociationResponse (..),
    newDeleteAssociationResponse,

    -- * Response Lenses
    deleteAssociationResponse_sourceArn,
    deleteAssociationResponse_destinationArn,
    deleteAssociationResponse_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

-- | /See:/ 'newDeleteAssociation' smart constructor.
data DeleteAssociation = DeleteAssociation'
  { -- | The ARN of the source.
    DeleteAssociation -> Text
sourceArn :: Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the destination.
    DeleteAssociation -> Text
destinationArn :: Prelude.Text
  }
  deriving (DeleteAssociation -> DeleteAssociation -> Bool
(DeleteAssociation -> DeleteAssociation -> Bool)
-> (DeleteAssociation -> DeleteAssociation -> Bool)
-> Eq DeleteAssociation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteAssociation -> DeleteAssociation -> Bool
$c/= :: DeleteAssociation -> DeleteAssociation -> Bool
== :: DeleteAssociation -> DeleteAssociation -> Bool
$c== :: DeleteAssociation -> DeleteAssociation -> Bool
Prelude.Eq, ReadPrec [DeleteAssociation]
ReadPrec DeleteAssociation
Int -> ReadS DeleteAssociation
ReadS [DeleteAssociation]
(Int -> ReadS DeleteAssociation)
-> ReadS [DeleteAssociation]
-> ReadPrec DeleteAssociation
-> ReadPrec [DeleteAssociation]
-> Read DeleteAssociation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteAssociation]
$creadListPrec :: ReadPrec [DeleteAssociation]
readPrec :: ReadPrec DeleteAssociation
$creadPrec :: ReadPrec DeleteAssociation
readList :: ReadS [DeleteAssociation]
$creadList :: ReadS [DeleteAssociation]
readsPrec :: Int -> ReadS DeleteAssociation
$creadsPrec :: Int -> ReadS DeleteAssociation
Prelude.Read, Int -> DeleteAssociation -> ShowS
[DeleteAssociation] -> ShowS
DeleteAssociation -> String
(Int -> DeleteAssociation -> ShowS)
-> (DeleteAssociation -> String)
-> ([DeleteAssociation] -> ShowS)
-> Show DeleteAssociation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteAssociation] -> ShowS
$cshowList :: [DeleteAssociation] -> ShowS
show :: DeleteAssociation -> String
$cshow :: DeleteAssociation -> String
showsPrec :: Int -> DeleteAssociation -> ShowS
$cshowsPrec :: Int -> DeleteAssociation -> ShowS
Prelude.Show, (forall x. DeleteAssociation -> Rep DeleteAssociation x)
-> (forall x. Rep DeleteAssociation x -> DeleteAssociation)
-> Generic DeleteAssociation
forall x. Rep DeleteAssociation x -> DeleteAssociation
forall x. DeleteAssociation -> Rep DeleteAssociation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteAssociation x -> DeleteAssociation
$cfrom :: forall x. DeleteAssociation -> Rep DeleteAssociation x
Prelude.Generic)

-- |
-- Create a value of 'DeleteAssociation' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'sourceArn', 'deleteAssociation_sourceArn' - The ARN of the source.
--
-- 'destinationArn', 'deleteAssociation_destinationArn' - The Amazon Resource Name (ARN) of the destination.
newDeleteAssociation ::
  -- | 'sourceArn'
  Prelude.Text ->
  -- | 'destinationArn'
  Prelude.Text ->
  DeleteAssociation
newDeleteAssociation :: Text -> Text -> DeleteAssociation
newDeleteAssociation Text
pSourceArn_ Text
pDestinationArn_ =
  DeleteAssociation' :: Text -> Text -> DeleteAssociation
DeleteAssociation'
    { $sel:sourceArn:DeleteAssociation' :: Text
sourceArn = Text
pSourceArn_,
      $sel:destinationArn:DeleteAssociation' :: Text
destinationArn = Text
pDestinationArn_
    }

-- | The ARN of the source.
deleteAssociation_sourceArn :: Lens.Lens' DeleteAssociation Prelude.Text
deleteAssociation_sourceArn :: (Text -> f Text) -> DeleteAssociation -> f DeleteAssociation
deleteAssociation_sourceArn = (DeleteAssociation -> Text)
-> (DeleteAssociation -> Text -> DeleteAssociation)
-> Lens DeleteAssociation DeleteAssociation Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteAssociation' {Text
sourceArn :: Text
$sel:sourceArn:DeleteAssociation' :: DeleteAssociation -> Text
sourceArn} -> Text
sourceArn) (\s :: DeleteAssociation
s@DeleteAssociation' {} Text
a -> DeleteAssociation
s {$sel:sourceArn:DeleteAssociation' :: Text
sourceArn = Text
a} :: DeleteAssociation)

-- | The Amazon Resource Name (ARN) of the destination.
deleteAssociation_destinationArn :: Lens.Lens' DeleteAssociation Prelude.Text
deleteAssociation_destinationArn :: (Text -> f Text) -> DeleteAssociation -> f DeleteAssociation
deleteAssociation_destinationArn = (DeleteAssociation -> Text)
-> (DeleteAssociation -> Text -> DeleteAssociation)
-> Lens DeleteAssociation DeleteAssociation Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteAssociation' {Text
destinationArn :: Text
$sel:destinationArn:DeleteAssociation' :: DeleteAssociation -> Text
destinationArn} -> Text
destinationArn) (\s :: DeleteAssociation
s@DeleteAssociation' {} Text
a -> DeleteAssociation
s {$sel:destinationArn:DeleteAssociation' :: Text
destinationArn = Text
a} :: DeleteAssociation)

instance Core.AWSRequest DeleteAssociation where
  type
    AWSResponse DeleteAssociation =
      DeleteAssociationResponse
  request :: DeleteAssociation -> Request DeleteAssociation
request = Service -> DeleteAssociation -> Request DeleteAssociation
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteAssociation
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteAssociation)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DeleteAssociation))
-> Logger
-> Service
-> Proxy DeleteAssociation
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteAssociation)))
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 -> DeleteAssociationResponse
DeleteAssociationResponse'
            (Maybe Text -> Maybe Text -> Int -> DeleteAssociationResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> DeleteAssociationResponse)
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 -> DeleteAssociationResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DeleteAssociationResponse)
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 -> DeleteAssociationResponse)
-> Either String Int -> Either String DeleteAssociationResponse
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 DeleteAssociation

instance Prelude.NFData DeleteAssociation

instance Core.ToHeaders DeleteAssociation where
  toHeaders :: DeleteAssociation -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteAssociation -> 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.DeleteAssociation" ::
                          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 DeleteAssociation where
  toJSON :: DeleteAssociation -> Value
toJSON DeleteAssociation' {Text
destinationArn :: Text
sourceArn :: Text
$sel:destinationArn:DeleteAssociation' :: DeleteAssociation -> Text
$sel:sourceArn:DeleteAssociation' :: DeleteAssociation -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ 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 DeleteAssociation where
  toPath :: DeleteAssociation -> ByteString
toPath = ByteString -> DeleteAssociation -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery DeleteAssociation where
  toQuery :: DeleteAssociation -> QueryString
toQuery = QueryString -> DeleteAssociation -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newDeleteAssociationResponse' smart constructor.
data DeleteAssociationResponse = DeleteAssociationResponse'
  { -- | The ARN of the source.
    DeleteAssociationResponse -> Maybe Text
sourceArn :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the destination.
    DeleteAssociationResponse -> Maybe Text
destinationArn :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DeleteAssociationResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DeleteAssociationResponse -> DeleteAssociationResponse -> Bool
(DeleteAssociationResponse -> DeleteAssociationResponse -> Bool)
-> (DeleteAssociationResponse -> DeleteAssociationResponse -> Bool)
-> Eq DeleteAssociationResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteAssociationResponse -> DeleteAssociationResponse -> Bool
$c/= :: DeleteAssociationResponse -> DeleteAssociationResponse -> Bool
== :: DeleteAssociationResponse -> DeleteAssociationResponse -> Bool
$c== :: DeleteAssociationResponse -> DeleteAssociationResponse -> Bool
Prelude.Eq, ReadPrec [DeleteAssociationResponse]
ReadPrec DeleteAssociationResponse
Int -> ReadS DeleteAssociationResponse
ReadS [DeleteAssociationResponse]
(Int -> ReadS DeleteAssociationResponse)
-> ReadS [DeleteAssociationResponse]
-> ReadPrec DeleteAssociationResponse
-> ReadPrec [DeleteAssociationResponse]
-> Read DeleteAssociationResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteAssociationResponse]
$creadListPrec :: ReadPrec [DeleteAssociationResponse]
readPrec :: ReadPrec DeleteAssociationResponse
$creadPrec :: ReadPrec DeleteAssociationResponse
readList :: ReadS [DeleteAssociationResponse]
$creadList :: ReadS [DeleteAssociationResponse]
readsPrec :: Int -> ReadS DeleteAssociationResponse
$creadsPrec :: Int -> ReadS DeleteAssociationResponse
Prelude.Read, Int -> DeleteAssociationResponse -> ShowS
[DeleteAssociationResponse] -> ShowS
DeleteAssociationResponse -> String
(Int -> DeleteAssociationResponse -> ShowS)
-> (DeleteAssociationResponse -> String)
-> ([DeleteAssociationResponse] -> ShowS)
-> Show DeleteAssociationResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteAssociationResponse] -> ShowS
$cshowList :: [DeleteAssociationResponse] -> ShowS
show :: DeleteAssociationResponse -> String
$cshow :: DeleteAssociationResponse -> String
showsPrec :: Int -> DeleteAssociationResponse -> ShowS
$cshowsPrec :: Int -> DeleteAssociationResponse -> ShowS
Prelude.Show, (forall x.
 DeleteAssociationResponse -> Rep DeleteAssociationResponse x)
-> (forall x.
    Rep DeleteAssociationResponse x -> DeleteAssociationResponse)
-> Generic DeleteAssociationResponse
forall x.
Rep DeleteAssociationResponse x -> DeleteAssociationResponse
forall x.
DeleteAssociationResponse -> Rep DeleteAssociationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteAssociationResponse x -> DeleteAssociationResponse
$cfrom :: forall x.
DeleteAssociationResponse -> Rep DeleteAssociationResponse x
Prelude.Generic)

-- |
-- Create a value of 'DeleteAssociationResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'sourceArn', 'deleteAssociationResponse_sourceArn' - The ARN of the source.
--
-- 'destinationArn', 'deleteAssociationResponse_destinationArn' - The Amazon Resource Name (ARN) of the destination.
--
-- 'httpStatus', 'deleteAssociationResponse_httpStatus' - The response's http status code.
newDeleteAssociationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteAssociationResponse
newDeleteAssociationResponse :: Int -> DeleteAssociationResponse
newDeleteAssociationResponse Int
pHttpStatus_ =
  DeleteAssociationResponse' :: Maybe Text -> Maybe Text -> Int -> DeleteAssociationResponse
DeleteAssociationResponse'
    { $sel:sourceArn:DeleteAssociationResponse' :: Maybe Text
sourceArn =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:destinationArn:DeleteAssociationResponse' :: Maybe Text
destinationArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DeleteAssociationResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The ARN of the source.
deleteAssociationResponse_sourceArn :: Lens.Lens' DeleteAssociationResponse (Prelude.Maybe Prelude.Text)
deleteAssociationResponse_sourceArn :: (Maybe Text -> f (Maybe Text))
-> DeleteAssociationResponse -> f DeleteAssociationResponse
deleteAssociationResponse_sourceArn = (DeleteAssociationResponse -> Maybe Text)
-> (DeleteAssociationResponse
    -> Maybe Text -> DeleteAssociationResponse)
-> Lens
     DeleteAssociationResponse
     DeleteAssociationResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteAssociationResponse' {Maybe Text
sourceArn :: Maybe Text
$sel:sourceArn:DeleteAssociationResponse' :: DeleteAssociationResponse -> Maybe Text
sourceArn} -> Maybe Text
sourceArn) (\s :: DeleteAssociationResponse
s@DeleteAssociationResponse' {} Maybe Text
a -> DeleteAssociationResponse
s {$sel:sourceArn:DeleteAssociationResponse' :: Maybe Text
sourceArn = Maybe Text
a} :: DeleteAssociationResponse)

-- | The Amazon Resource Name (ARN) of the destination.
deleteAssociationResponse_destinationArn :: Lens.Lens' DeleteAssociationResponse (Prelude.Maybe Prelude.Text)
deleteAssociationResponse_destinationArn :: (Maybe Text -> f (Maybe Text))
-> DeleteAssociationResponse -> f DeleteAssociationResponse
deleteAssociationResponse_destinationArn = (DeleteAssociationResponse -> Maybe Text)
-> (DeleteAssociationResponse
    -> Maybe Text -> DeleteAssociationResponse)
-> Lens
     DeleteAssociationResponse
     DeleteAssociationResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteAssociationResponse' {Maybe Text
destinationArn :: Maybe Text
$sel:destinationArn:DeleteAssociationResponse' :: DeleteAssociationResponse -> Maybe Text
destinationArn} -> Maybe Text
destinationArn) (\s :: DeleteAssociationResponse
s@DeleteAssociationResponse' {} Maybe Text
a -> DeleteAssociationResponse
s {$sel:destinationArn:DeleteAssociationResponse' :: Maybe Text
destinationArn = Maybe Text
a} :: DeleteAssociationResponse)

-- | The response's http status code.
deleteAssociationResponse_httpStatus :: Lens.Lens' DeleteAssociationResponse Prelude.Int
deleteAssociationResponse_httpStatus :: (Int -> f Int)
-> DeleteAssociationResponse -> f DeleteAssociationResponse
deleteAssociationResponse_httpStatus = (DeleteAssociationResponse -> Int)
-> (DeleteAssociationResponse -> Int -> DeleteAssociationResponse)
-> Lens DeleteAssociationResponse DeleteAssociationResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteAssociationResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteAssociationResponse' :: DeleteAssociationResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeleteAssociationResponse
s@DeleteAssociationResponse' {} Int
a -> DeleteAssociationResponse
s {$sel:httpStatus:DeleteAssociationResponse' :: Int
httpStatus = Int
a} :: DeleteAssociationResponse)

instance Prelude.NFData DeleteAssociationResponse