{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates an Amazon Web Services resource association with an Amazon
-- Connect instance.
module Amazonka.Connect.CreateIntegrationAssociation
  ( -- * Creating a Request
    CreateIntegrationAssociation (..),
    newCreateIntegrationAssociation,

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

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

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

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

-- | /See:/ 'newCreateIntegrationAssociation' smart constructor.
data CreateIntegrationAssociation = CreateIntegrationAssociation'
  { -- | The name of the external application. This field is only required for
    -- the EVENT integration type.
    CreateIntegrationAssociation -> Maybe Text
sourceApplicationName :: Prelude.Maybe Prelude.Text,
    -- | 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 type of the data source. This field is only required for the EVENT
    -- integration type.
    CreateIntegrationAssociation -> Maybe SourceType
sourceType :: Prelude.Maybe SourceType,
    -- | The tags used to organize, track, or control access for this resource.
    -- For example, { \"tags\": {\"key1\":\"value1\", \"key2\":\"value2\"} }.
    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.
    --
    -- When integrating with Amazon Pinpoint, the Amazon Connect and Amazon
    -- Pinpoint instances must be in the same account.
    CreateIntegrationAssociation -> Text
integrationArn :: Prelude.Text
  }
  deriving (CreateIntegrationAssociation
-> CreateIntegrationAssociation -> Bool
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]
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
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.
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:
--
-- 'sourceApplicationName', 'createIntegrationAssociation_sourceApplicationName' - The name of the external application. 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.
--
-- 'sourceType', 'createIntegrationAssociation_sourceType' - The type of the data source. This field is only required for the EVENT
-- integration type.
--
-- 'tags', 'createIntegrationAssociation_tags' - The tags used to organize, track, or control access for this resource.
-- For example, { \"tags\": {\"key1\":\"value1\", \"key2\":\"value2\"} }.
--
-- '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.
--
-- When integrating with Amazon Pinpoint, the Amazon Connect and Amazon
-- Pinpoint instances must be in the same account.
newCreateIntegrationAssociation ::
  -- | 'instanceId'
  Prelude.Text ->
  -- | 'integrationType'
  IntegrationType ->
  -- | 'integrationArn'
  Prelude.Text ->
  CreateIntegrationAssociation
newCreateIntegrationAssociation :: Text -> IntegrationType -> Text -> CreateIntegrationAssociation
newCreateIntegrationAssociation
  Text
pInstanceId_
  IntegrationType
pIntegrationType_
  Text
pIntegrationArn_ =
    CreateIntegrationAssociation'
      { $sel:sourceApplicationName:CreateIntegrationAssociation' :: Maybe Text
sourceApplicationName =
          forall a. Maybe a
Prelude.Nothing,
        $sel:sourceApplicationUrl:CreateIntegrationAssociation' :: Maybe Text
sourceApplicationUrl = forall a. Maybe a
Prelude.Nothing,
        $sel:sourceType:CreateIntegrationAssociation' :: Maybe SourceType
sourceType = forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateIntegrationAssociation' :: Maybe (HashMap Text Text)
tags = 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 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 :: Lens' CreateIntegrationAssociation (Maybe Text)
createIntegrationAssociation_sourceApplicationName = 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)

-- | 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 :: Lens' CreateIntegrationAssociation (Maybe Text)
createIntegrationAssociation_sourceApplicationUrl = 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 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 :: Lens' CreateIntegrationAssociation (Maybe SourceType)
createIntegrationAssociation_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 tags used to organize, track, or control access for this resource.
-- For example, { \"tags\": {\"key1\":\"value1\", \"key2\":\"value2\"} }.
createIntegrationAssociation_tags :: Lens.Lens' CreateIntegrationAssociation (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createIntegrationAssociation_tags :: Lens' CreateIntegrationAssociation (Maybe (HashMap Text Text))
createIntegrationAssociation_tags = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 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 :: Lens' CreateIntegrationAssociation Text
createIntegrationAssociation_instanceId = 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 :: Lens' CreateIntegrationAssociation IntegrationType
createIntegrationAssociation_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.
--
-- When integrating with Amazon Pinpoint, the Amazon Connect and Amazon
-- Pinpoint instances must be in the same account.
createIntegrationAssociation_integrationArn :: Lens.Lens' CreateIntegrationAssociation Prelude.Text
createIntegrationAssociation_integrationArn :: Lens' CreateIntegrationAssociation Text
createIntegrationAssociation_integrationArn = 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 :: (Service -> Service)
-> CreateIntegrationAssociation
-> Request CreateIntegrationAssociation
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateIntegrationAssociation
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateIntegrationAssociation)))
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
-> Maybe Text -> Int -> CreateIntegrationAssociationResponse
CreateIntegrationAssociationResponse'
            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
"IntegrationAssociationArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"IntegrationAssociationId")
            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
    CreateIntegrationAssociation
  where
  hashWithSalt :: Int -> CreateIntegrationAssociation -> Int
hashWithSalt Int
_salt CreateIntegrationAssociation' {Maybe Text
Maybe (HashMap Text Text)
Maybe SourceType
Text
IntegrationType
integrationArn :: Text
integrationType :: IntegrationType
instanceId :: Text
tags :: Maybe (HashMap Text Text)
sourceType :: Maybe SourceType
sourceApplicationUrl :: Maybe Text
sourceApplicationName :: Maybe Text
$sel:integrationArn:CreateIntegrationAssociation' :: CreateIntegrationAssociation -> Text
$sel:integrationType:CreateIntegrationAssociation' :: CreateIntegrationAssociation -> IntegrationType
$sel:instanceId:CreateIntegrationAssociation' :: CreateIntegrationAssociation -> Text
$sel:tags:CreateIntegrationAssociation' :: CreateIntegrationAssociation -> Maybe (HashMap Text Text)
$sel:sourceType:CreateIntegrationAssociation' :: CreateIntegrationAssociation -> Maybe SourceType
$sel:sourceApplicationUrl:CreateIntegrationAssociation' :: CreateIntegrationAssociation -> Maybe Text
$sel:sourceApplicationName:CreateIntegrationAssociation' :: CreateIntegrationAssociation -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
sourceApplicationName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
sourceApplicationUrl
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SourceType
sourceType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
tags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
instanceId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` IntegrationType
integrationType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
integrationArn

instance Prelude.NFData CreateIntegrationAssociation where
  rnf :: CreateIntegrationAssociation -> ()
rnf CreateIntegrationAssociation' {Maybe Text
Maybe (HashMap Text Text)
Maybe SourceType
Text
IntegrationType
integrationArn :: Text
integrationType :: IntegrationType
instanceId :: Text
tags :: Maybe (HashMap Text Text)
sourceType :: Maybe SourceType
sourceApplicationUrl :: Maybe Text
sourceApplicationName :: Maybe Text
$sel:integrationArn:CreateIntegrationAssociation' :: CreateIntegrationAssociation -> Text
$sel:integrationType:CreateIntegrationAssociation' :: CreateIntegrationAssociation -> IntegrationType
$sel:instanceId:CreateIntegrationAssociation' :: CreateIntegrationAssociation -> Text
$sel:tags:CreateIntegrationAssociation' :: CreateIntegrationAssociation -> Maybe (HashMap Text Text)
$sel:sourceType:CreateIntegrationAssociation' :: CreateIntegrationAssociation -> Maybe SourceType
$sel:sourceApplicationUrl:CreateIntegrationAssociation' :: CreateIntegrationAssociation -> Maybe Text
$sel:sourceApplicationName:CreateIntegrationAssociation' :: CreateIntegrationAssociation -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
sourceApplicationName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
sourceApplicationUrl
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe SourceType
sourceType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
tags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
instanceId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf IntegrationType
integrationType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
integrationArn

instance Data.ToHeaders CreateIntegrationAssociation where
  toHeaders :: CreateIntegrationAssociation -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

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

instance Data.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)
sourceType :: Maybe SourceType
sourceApplicationUrl :: Maybe Text
sourceApplicationName :: Maybe Text
$sel:integrationArn:CreateIntegrationAssociation' :: CreateIntegrationAssociation -> Text
$sel:integrationType:CreateIntegrationAssociation' :: CreateIntegrationAssociation -> IntegrationType
$sel:instanceId:CreateIntegrationAssociation' :: CreateIntegrationAssociation -> Text
$sel:tags:CreateIntegrationAssociation' :: CreateIntegrationAssociation -> Maybe (HashMap Text Text)
$sel:sourceType:CreateIntegrationAssociation' :: CreateIntegrationAssociation -> Maybe SourceType
$sel:sourceApplicationUrl:CreateIntegrationAssociation' :: CreateIntegrationAssociation -> Maybe Text
$sel:sourceApplicationName:CreateIntegrationAssociation' :: CreateIntegrationAssociation -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/instance/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
instanceId,
        ByteString
"/integration-associations"
      ]

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

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

-- | The Amazon Resource Name (ARN) for the association.
createIntegrationAssociationResponse_integrationAssociationArn :: Lens.Lens' CreateIntegrationAssociationResponse (Prelude.Maybe Prelude.Text)
createIntegrationAssociationResponse_integrationAssociationArn :: Lens' CreateIntegrationAssociationResponse (Maybe Text)
createIntegrationAssociationResponse_integrationAssociationArn = 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 identifier for the integration association.
createIntegrationAssociationResponse_integrationAssociationId :: Lens.Lens' CreateIntegrationAssociationResponse (Prelude.Maybe Prelude.Text)
createIntegrationAssociationResponse_integrationAssociationId :: Lens' CreateIntegrationAssociationResponse (Maybe Text)
createIntegrationAssociationResponse_integrationAssociationId = 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 response's http status code.
createIntegrationAssociationResponse_httpStatus :: Lens.Lens' CreateIntegrationAssociationResponse Prelude.Int
createIntegrationAssociationResponse_httpStatus :: Lens' CreateIntegrationAssociationResponse Int
createIntegrationAssociationResponse_httpStatus = 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
  where
  rnf :: CreateIntegrationAssociationResponse -> ()
rnf CreateIntegrationAssociationResponse' {Int
Maybe Text
httpStatus :: Int
integrationAssociationId :: Maybe Text
integrationAssociationArn :: Maybe Text
$sel:httpStatus:CreateIntegrationAssociationResponse' :: CreateIntegrationAssociationResponse -> Int
$sel:integrationAssociationId:CreateIntegrationAssociationResponse' :: CreateIntegrationAssociationResponse -> Maybe Text
$sel:integrationAssociationArn:CreateIntegrationAssociationResponse' :: CreateIntegrationAssociationResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
integrationAssociationArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
integrationAssociationId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus