{-# 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.Connect.CreateIntegrationAssociation
-- 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)
--
-- Creates an AWS resource association with an Amazon Connect instance.
module Amazonka.Connect.CreateIntegrationAssociation
  ( -- * Creating a Request
    CreateIntegrationAssociation (..),
    newCreateIntegrationAssociation,

    -- * Request Lenses
    createIntegrationAssociation_sourceType,
    createIntegrationAssociation_sourceApplicationUrl,
    createIntegrationAssociation_sourceApplicationName,
    createIntegrationAssociation_tags,
    createIntegrationAssociation_instanceId,
    createIntegrationAssociation_integrationType,
    createIntegrationAssociation_integrationArn,

    -- * Destructuring the Response
    CreateIntegrationAssociationResponse (..),
    newCreateIntegrationAssociationResponse,

    -- * Response Lenses
    createIntegrationAssociationResponse_integrationAssociationId,
    createIntegrationAssociationResponse_integrationAssociationArn,
    createIntegrationAssociationResponse_httpStatus,
  )
where

import Amazonka.Connect.Types
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

-- | /See:/ 'newCreateIntegrationAssociation' smart constructor.
data CreateIntegrationAssociation = CreateIntegrationAssociation'
  { -- | The type of the data source. This field is only required for the EVENT
    -- integration type.
    CreateIntegrationAssociation -> Maybe SourceType
sourceType :: Prelude.Maybe SourceType,
    -- | The URL for the external application. This field is only required for
    -- the EVENT integration type.
    CreateIntegrationAssociation -> Maybe Text
sourceApplicationUrl :: Prelude.Maybe Prelude.Text,
    -- | The name of the external application. This field is only required for
    -- the EVENT integration type.
    CreateIntegrationAssociation -> Maybe Text
sourceApplicationName :: Prelude.Maybe Prelude.Text,
    -- | One or more tags.
    CreateIntegrationAssociation -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The identifier of the Amazon Connect instance. You can find the
    -- instanceId in the ARN of the instance.
    CreateIntegrationAssociation -> Text
instanceId :: Prelude.Text,
    -- | The type of information to be ingested.
    CreateIntegrationAssociation -> IntegrationType
integrationType :: IntegrationType,
    -- | The Amazon Resource Name (ARN) of the integration.
    CreateIntegrationAssociation -> Text
integrationArn :: Prelude.Text
  }
  deriving (CreateIntegrationAssociation
-> CreateIntegrationAssociation -> Bool
(CreateIntegrationAssociation
 -> CreateIntegrationAssociation -> Bool)
-> (CreateIntegrationAssociation
    -> CreateIntegrationAssociation -> Bool)
-> Eq CreateIntegrationAssociation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateIntegrationAssociation
-> CreateIntegrationAssociation -> Bool
$c/= :: CreateIntegrationAssociation
-> CreateIntegrationAssociation -> Bool
== :: CreateIntegrationAssociation
-> CreateIntegrationAssociation -> Bool
$c== :: CreateIntegrationAssociation
-> CreateIntegrationAssociation -> Bool
Prelude.Eq, ReadPrec [CreateIntegrationAssociation]
ReadPrec CreateIntegrationAssociation
Int -> ReadS CreateIntegrationAssociation
ReadS [CreateIntegrationAssociation]
(Int -> ReadS CreateIntegrationAssociation)
-> ReadS [CreateIntegrationAssociation]
-> ReadPrec CreateIntegrationAssociation
-> ReadPrec [CreateIntegrationAssociation]
-> Read CreateIntegrationAssociation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateIntegrationAssociation]
$creadListPrec :: ReadPrec [CreateIntegrationAssociation]
readPrec :: ReadPrec CreateIntegrationAssociation
$creadPrec :: ReadPrec CreateIntegrationAssociation
readList :: ReadS [CreateIntegrationAssociation]
$creadList :: ReadS [CreateIntegrationAssociation]
readsPrec :: Int -> ReadS CreateIntegrationAssociation
$creadsPrec :: Int -> ReadS CreateIntegrationAssociation
Prelude.Read, Int -> CreateIntegrationAssociation -> ShowS
[CreateIntegrationAssociation] -> ShowS
CreateIntegrationAssociation -> String
(Int -> CreateIntegrationAssociation -> ShowS)
-> (CreateIntegrationAssociation -> String)
-> ([CreateIntegrationAssociation] -> ShowS)
-> Show CreateIntegrationAssociation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateIntegrationAssociation] -> ShowS
$cshowList :: [CreateIntegrationAssociation] -> ShowS
show :: CreateIntegrationAssociation -> String
$cshow :: CreateIntegrationAssociation -> String
showsPrec :: Int -> CreateIntegrationAssociation -> ShowS
$cshowsPrec :: Int -> CreateIntegrationAssociation -> ShowS
Prelude.Show, (forall x.
 CreateIntegrationAssociation -> Rep CreateIntegrationAssociation x)
-> (forall x.
    Rep CreateIntegrationAssociation x -> CreateIntegrationAssociation)
-> Generic CreateIntegrationAssociation
forall x.
Rep CreateIntegrationAssociation x -> CreateIntegrationAssociation
forall x.
CreateIntegrationAssociation -> Rep CreateIntegrationAssociation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateIntegrationAssociation x -> CreateIntegrationAssociation
$cfrom :: forall x.
CreateIntegrationAssociation -> Rep CreateIntegrationAssociation x
Prelude.Generic)

-- |
-- Create a value of 'CreateIntegrationAssociation' 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:
--
-- 'sourceType', 'createIntegrationAssociation_sourceType' - The type of the data source. This field is only required for the EVENT
-- integration type.
--
-- 'sourceApplicationUrl', 'createIntegrationAssociation_sourceApplicationUrl' - The URL for the external application. This field is only required for
-- the EVENT integration type.
--
-- 'sourceApplicationName', 'createIntegrationAssociation_sourceApplicationName' - The name of the external application. This field is only required for
-- the EVENT integration type.
--
-- 'tags', 'createIntegrationAssociation_tags' - One or more tags.
--
-- 'instanceId', 'createIntegrationAssociation_instanceId' - The identifier of the Amazon Connect instance. You can find the
-- instanceId in the ARN of the instance.
--
-- 'integrationType', 'createIntegrationAssociation_integrationType' - The type of information to be ingested.
--
-- 'integrationArn', 'createIntegrationAssociation_integrationArn' - The Amazon Resource Name (ARN) of the integration.
newCreateIntegrationAssociation ::
  -- | 'instanceId'
  Prelude.Text ->
  -- | 'integrationType'
  IntegrationType ->
  -- | 'integrationArn'
  Prelude.Text ->
  CreateIntegrationAssociation
newCreateIntegrationAssociation :: Text -> IntegrationType -> Text -> CreateIntegrationAssociation
newCreateIntegrationAssociation
  Text
pInstanceId_
  IntegrationType
pIntegrationType_
  Text
pIntegrationArn_ =
    CreateIntegrationAssociation' :: Maybe SourceType
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Text
-> IntegrationType
-> Text
-> CreateIntegrationAssociation
CreateIntegrationAssociation'
      { $sel:sourceType:CreateIntegrationAssociation' :: Maybe SourceType
sourceType =
          Maybe SourceType
forall a. Maybe a
Prelude.Nothing,
        $sel:sourceApplicationUrl:CreateIntegrationAssociation' :: Maybe Text
sourceApplicationUrl = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:sourceApplicationName:CreateIntegrationAssociation' :: Maybe Text
sourceApplicationName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateIntegrationAssociation' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:instanceId:CreateIntegrationAssociation' :: Text
instanceId = Text
pInstanceId_,
        $sel:integrationType:CreateIntegrationAssociation' :: IntegrationType
integrationType = IntegrationType
pIntegrationType_,
        $sel:integrationArn:CreateIntegrationAssociation' :: Text
integrationArn = Text
pIntegrationArn_
      }

-- | The type of the data source. This field is only required for the EVENT
-- integration type.
createIntegrationAssociation_sourceType :: Lens.Lens' CreateIntegrationAssociation (Prelude.Maybe SourceType)
createIntegrationAssociation_sourceType :: (Maybe SourceType -> f (Maybe SourceType))
-> CreateIntegrationAssociation -> f CreateIntegrationAssociation
createIntegrationAssociation_sourceType = (CreateIntegrationAssociation -> Maybe SourceType)
-> (CreateIntegrationAssociation
    -> Maybe SourceType -> CreateIntegrationAssociation)
-> Lens
     CreateIntegrationAssociation
     CreateIntegrationAssociation
     (Maybe SourceType)
     (Maybe SourceType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateIntegrationAssociation' {Maybe SourceType
sourceType :: Maybe SourceType
$sel:sourceType:CreateIntegrationAssociation' :: CreateIntegrationAssociation -> Maybe SourceType
sourceType} -> Maybe SourceType
sourceType) (\s :: CreateIntegrationAssociation
s@CreateIntegrationAssociation' {} Maybe SourceType
a -> CreateIntegrationAssociation
s {$sel:sourceType:CreateIntegrationAssociation' :: Maybe SourceType
sourceType = Maybe SourceType
a} :: CreateIntegrationAssociation)

-- | The URL for the external application. This field is only required for
-- the EVENT integration type.
createIntegrationAssociation_sourceApplicationUrl :: Lens.Lens' CreateIntegrationAssociation (Prelude.Maybe Prelude.Text)
createIntegrationAssociation_sourceApplicationUrl :: (Maybe Text -> f (Maybe Text))
-> CreateIntegrationAssociation -> f CreateIntegrationAssociation
createIntegrationAssociation_sourceApplicationUrl = (CreateIntegrationAssociation -> Maybe Text)
-> (CreateIntegrationAssociation
    -> Maybe Text -> CreateIntegrationAssociation)
-> Lens
     CreateIntegrationAssociation
     CreateIntegrationAssociation
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateIntegrationAssociation' {Maybe Text
sourceApplicationUrl :: Maybe Text
$sel:sourceApplicationUrl:CreateIntegrationAssociation' :: CreateIntegrationAssociation -> Maybe Text
sourceApplicationUrl} -> Maybe Text
sourceApplicationUrl) (\s :: CreateIntegrationAssociation
s@CreateIntegrationAssociation' {} Maybe Text
a -> CreateIntegrationAssociation
s {$sel:sourceApplicationUrl:CreateIntegrationAssociation' :: Maybe Text
sourceApplicationUrl = Maybe Text
a} :: CreateIntegrationAssociation)

-- | The name of the external application. This field is only required for
-- the EVENT integration type.
createIntegrationAssociation_sourceApplicationName :: Lens.Lens' CreateIntegrationAssociation (Prelude.Maybe Prelude.Text)
createIntegrationAssociation_sourceApplicationName :: (Maybe Text -> f (Maybe Text))
-> CreateIntegrationAssociation -> f CreateIntegrationAssociation
createIntegrationAssociation_sourceApplicationName = (CreateIntegrationAssociation -> Maybe Text)
-> (CreateIntegrationAssociation
    -> Maybe Text -> CreateIntegrationAssociation)
-> Lens
     CreateIntegrationAssociation
     CreateIntegrationAssociation
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateIntegrationAssociation' {Maybe Text
sourceApplicationName :: Maybe Text
$sel:sourceApplicationName:CreateIntegrationAssociation' :: CreateIntegrationAssociation -> Maybe Text
sourceApplicationName} -> Maybe Text
sourceApplicationName) (\s :: CreateIntegrationAssociation
s@CreateIntegrationAssociation' {} Maybe Text
a -> CreateIntegrationAssociation
s {$sel:sourceApplicationName:CreateIntegrationAssociation' :: Maybe Text
sourceApplicationName = Maybe Text
a} :: CreateIntegrationAssociation)

-- | One or more tags.
createIntegrationAssociation_tags :: Lens.Lens' CreateIntegrationAssociation (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createIntegrationAssociation_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateIntegrationAssociation -> f CreateIntegrationAssociation
createIntegrationAssociation_tags = (CreateIntegrationAssociation -> Maybe (HashMap Text Text))
-> (CreateIntegrationAssociation
    -> Maybe (HashMap Text Text) -> CreateIntegrationAssociation)
-> Lens
     CreateIntegrationAssociation
     CreateIntegrationAssociation
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateIntegrationAssociation' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateIntegrationAssociation' :: CreateIntegrationAssociation -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateIntegrationAssociation
s@CreateIntegrationAssociation' {} Maybe (HashMap Text Text)
a -> CreateIntegrationAssociation
s {$sel:tags:CreateIntegrationAssociation' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateIntegrationAssociation) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> CreateIntegrationAssociation -> f CreateIntegrationAssociation)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateIntegrationAssociation
-> f CreateIntegrationAssociation
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The identifier of the Amazon Connect instance. You can find the
-- instanceId in the ARN of the instance.
createIntegrationAssociation_instanceId :: Lens.Lens' CreateIntegrationAssociation Prelude.Text
createIntegrationAssociation_instanceId :: (Text -> f Text)
-> CreateIntegrationAssociation -> f CreateIntegrationAssociation
createIntegrationAssociation_instanceId = (CreateIntegrationAssociation -> Text)
-> (CreateIntegrationAssociation
    -> Text -> CreateIntegrationAssociation)
-> Lens
     CreateIntegrationAssociation CreateIntegrationAssociation Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateIntegrationAssociation' {Text
instanceId :: Text
$sel:instanceId:CreateIntegrationAssociation' :: CreateIntegrationAssociation -> Text
instanceId} -> Text
instanceId) (\s :: CreateIntegrationAssociation
s@CreateIntegrationAssociation' {} Text
a -> CreateIntegrationAssociation
s {$sel:instanceId:CreateIntegrationAssociation' :: Text
instanceId = Text
a} :: CreateIntegrationAssociation)

-- | The type of information to be ingested.
createIntegrationAssociation_integrationType :: Lens.Lens' CreateIntegrationAssociation IntegrationType
createIntegrationAssociation_integrationType :: (IntegrationType -> f IntegrationType)
-> CreateIntegrationAssociation -> f CreateIntegrationAssociation
createIntegrationAssociation_integrationType = (CreateIntegrationAssociation -> IntegrationType)
-> (CreateIntegrationAssociation
    -> IntegrationType -> CreateIntegrationAssociation)
-> Lens
     CreateIntegrationAssociation
     CreateIntegrationAssociation
     IntegrationType
     IntegrationType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateIntegrationAssociation' {IntegrationType
integrationType :: IntegrationType
$sel:integrationType:CreateIntegrationAssociation' :: CreateIntegrationAssociation -> IntegrationType
integrationType} -> IntegrationType
integrationType) (\s :: CreateIntegrationAssociation
s@CreateIntegrationAssociation' {} IntegrationType
a -> CreateIntegrationAssociation
s {$sel:integrationType:CreateIntegrationAssociation' :: IntegrationType
integrationType = IntegrationType
a} :: CreateIntegrationAssociation)

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

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

instance Prelude.NFData CreateIntegrationAssociation

instance Core.ToHeaders CreateIntegrationAssociation where
  toHeaders :: CreateIntegrationAssociation -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateIntegrationAssociation -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ 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 CreateIntegrationAssociation where
  toJSON :: CreateIntegrationAssociation -> Value
toJSON CreateIntegrationAssociation' {Maybe Text
Maybe (HashMap Text Text)
Maybe SourceType
Text
IntegrationType
integrationArn :: Text
integrationType :: IntegrationType
instanceId :: Text
tags :: Maybe (HashMap Text Text)
sourceApplicationName :: Maybe Text
sourceApplicationUrl :: Maybe Text
sourceType :: Maybe SourceType
$sel:integrationArn:CreateIntegrationAssociation' :: CreateIntegrationAssociation -> Text
$sel:integrationType:CreateIntegrationAssociation' :: CreateIntegrationAssociation -> IntegrationType
$sel:instanceId:CreateIntegrationAssociation' :: CreateIntegrationAssociation -> Text
$sel:tags:CreateIntegrationAssociation' :: CreateIntegrationAssociation -> Maybe (HashMap Text Text)
$sel:sourceApplicationName:CreateIntegrationAssociation' :: CreateIntegrationAssociation -> Maybe Text
$sel:sourceApplicationUrl:CreateIntegrationAssociation' :: CreateIntegrationAssociation -> Maybe Text
$sel:sourceType:CreateIntegrationAssociation' :: CreateIntegrationAssociation -> Maybe SourceType
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"SourceType" Text -> SourceType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (SourceType -> Pair) -> Maybe SourceType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SourceType
sourceType,
            (Text
"SourceApplicationUrl" 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
sourceApplicationUrl,
            (Text
"SourceApplicationName" 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
sourceApplicationName,
            (Text
"Tags" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
tags,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"IntegrationType" Text -> IntegrationType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= IntegrationType
integrationType),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"IntegrationArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
integrationArn)
          ]
      )

instance Core.ToPath CreateIntegrationAssociation where
  toPath :: CreateIntegrationAssociation -> ByteString
toPath CreateIntegrationAssociation' {Maybe Text
Maybe (HashMap Text Text)
Maybe SourceType
Text
IntegrationType
integrationArn :: Text
integrationType :: IntegrationType
instanceId :: Text
tags :: Maybe (HashMap Text Text)
sourceApplicationName :: Maybe Text
sourceApplicationUrl :: Maybe Text
sourceType :: Maybe SourceType
$sel:integrationArn:CreateIntegrationAssociation' :: CreateIntegrationAssociation -> Text
$sel:integrationType:CreateIntegrationAssociation' :: CreateIntegrationAssociation -> IntegrationType
$sel:instanceId:CreateIntegrationAssociation' :: CreateIntegrationAssociation -> Text
$sel:tags:CreateIntegrationAssociation' :: CreateIntegrationAssociation -> Maybe (HashMap Text Text)
$sel:sourceApplicationName:CreateIntegrationAssociation' :: CreateIntegrationAssociation -> Maybe Text
$sel:sourceApplicationUrl:CreateIntegrationAssociation' :: CreateIntegrationAssociation -> Maybe Text
$sel:sourceType:CreateIntegrationAssociation' :: CreateIntegrationAssociation -> Maybe SourceType
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/instance/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
instanceId,
        ByteString
"/integration-associations"
      ]

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

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

-- |
-- Create a value of 'CreateIntegrationAssociationResponse' 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:
--
-- 'integrationAssociationId', 'createIntegrationAssociationResponse_integrationAssociationId' - The identifier for the integration association.
--
-- 'integrationAssociationArn', 'createIntegrationAssociationResponse_integrationAssociationArn' - The Amazon Resource Name (ARN) for the association.
--
-- 'httpStatus', 'createIntegrationAssociationResponse_httpStatus' - The response's http status code.
newCreateIntegrationAssociationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateIntegrationAssociationResponse
newCreateIntegrationAssociationResponse :: Int -> CreateIntegrationAssociationResponse
newCreateIntegrationAssociationResponse Int
pHttpStatus_ =
  CreateIntegrationAssociationResponse' :: Maybe Text
-> Maybe Text -> Int -> CreateIntegrationAssociationResponse
CreateIntegrationAssociationResponse'
    { $sel:integrationAssociationId:CreateIntegrationAssociationResponse' :: Maybe Text
integrationAssociationId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:integrationAssociationArn:CreateIntegrationAssociationResponse' :: Maybe Text
integrationAssociationArn =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateIntegrationAssociationResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The identifier for the integration association.
createIntegrationAssociationResponse_integrationAssociationId :: Lens.Lens' CreateIntegrationAssociationResponse (Prelude.Maybe Prelude.Text)
createIntegrationAssociationResponse_integrationAssociationId :: (Maybe Text -> f (Maybe Text))
-> CreateIntegrationAssociationResponse
-> f CreateIntegrationAssociationResponse
createIntegrationAssociationResponse_integrationAssociationId = (CreateIntegrationAssociationResponse -> Maybe Text)
-> (CreateIntegrationAssociationResponse
    -> Maybe Text -> CreateIntegrationAssociationResponse)
-> Lens
     CreateIntegrationAssociationResponse
     CreateIntegrationAssociationResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateIntegrationAssociationResponse' {Maybe Text
integrationAssociationId :: Maybe Text
$sel:integrationAssociationId:CreateIntegrationAssociationResponse' :: CreateIntegrationAssociationResponse -> Maybe Text
integrationAssociationId} -> Maybe Text
integrationAssociationId) (\s :: CreateIntegrationAssociationResponse
s@CreateIntegrationAssociationResponse' {} Maybe Text
a -> CreateIntegrationAssociationResponse
s {$sel:integrationAssociationId:CreateIntegrationAssociationResponse' :: Maybe Text
integrationAssociationId = Maybe Text
a} :: CreateIntegrationAssociationResponse)

-- | The Amazon Resource Name (ARN) for the association.
createIntegrationAssociationResponse_integrationAssociationArn :: Lens.Lens' CreateIntegrationAssociationResponse (Prelude.Maybe Prelude.Text)
createIntegrationAssociationResponse_integrationAssociationArn :: (Maybe Text -> f (Maybe Text))
-> CreateIntegrationAssociationResponse
-> f CreateIntegrationAssociationResponse
createIntegrationAssociationResponse_integrationAssociationArn = (CreateIntegrationAssociationResponse -> Maybe Text)
-> (CreateIntegrationAssociationResponse
    -> Maybe Text -> CreateIntegrationAssociationResponse)
-> Lens
     CreateIntegrationAssociationResponse
     CreateIntegrationAssociationResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateIntegrationAssociationResponse' {Maybe Text
integrationAssociationArn :: Maybe Text
$sel:integrationAssociationArn:CreateIntegrationAssociationResponse' :: CreateIntegrationAssociationResponse -> Maybe Text
integrationAssociationArn} -> Maybe Text
integrationAssociationArn) (\s :: CreateIntegrationAssociationResponse
s@CreateIntegrationAssociationResponse' {} Maybe Text
a -> CreateIntegrationAssociationResponse
s {$sel:integrationAssociationArn:CreateIntegrationAssociationResponse' :: Maybe Text
integrationAssociationArn = Maybe Text
a} :: CreateIntegrationAssociationResponse)

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

instance
  Prelude.NFData
    CreateIntegrationAssociationResponse