{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

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

-- |
-- Module      : Amazonka.ServiceCatalog.Types.ServiceActionAssociation
-- 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)
module Amazonka.ServiceCatalog.Types.ServiceActionAssociation where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | A self-service action association consisting of the Action ID, the
-- Product ID, and the Provisioning Artifact ID.
--
-- /See:/ 'newServiceActionAssociation' smart constructor.
data ServiceActionAssociation = ServiceActionAssociation'
  { -- | The self-service action identifier. For example, @act-fs7abcd89wxyz@.
    ServiceActionAssociation -> Text
serviceActionId :: Prelude.Text,
    -- | The product identifier. For example, @prod-abcdzk7xy33qa@.
    ServiceActionAssociation -> Text
productId :: Prelude.Text,
    -- | The identifier of the provisioning artifact. For example,
    -- @pa-4abcdjnxjj6ne@.
    ServiceActionAssociation -> Text
provisioningArtifactId :: Prelude.Text
  }
  deriving (ServiceActionAssociation -> ServiceActionAssociation -> Bool
(ServiceActionAssociation -> ServiceActionAssociation -> Bool)
-> (ServiceActionAssociation -> ServiceActionAssociation -> Bool)
-> Eq ServiceActionAssociation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ServiceActionAssociation -> ServiceActionAssociation -> Bool
$c/= :: ServiceActionAssociation -> ServiceActionAssociation -> Bool
== :: ServiceActionAssociation -> ServiceActionAssociation -> Bool
$c== :: ServiceActionAssociation -> ServiceActionAssociation -> Bool
Prelude.Eq, ReadPrec [ServiceActionAssociation]
ReadPrec ServiceActionAssociation
Int -> ReadS ServiceActionAssociation
ReadS [ServiceActionAssociation]
(Int -> ReadS ServiceActionAssociation)
-> ReadS [ServiceActionAssociation]
-> ReadPrec ServiceActionAssociation
-> ReadPrec [ServiceActionAssociation]
-> Read ServiceActionAssociation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ServiceActionAssociation]
$creadListPrec :: ReadPrec [ServiceActionAssociation]
readPrec :: ReadPrec ServiceActionAssociation
$creadPrec :: ReadPrec ServiceActionAssociation
readList :: ReadS [ServiceActionAssociation]
$creadList :: ReadS [ServiceActionAssociation]
readsPrec :: Int -> ReadS ServiceActionAssociation
$creadsPrec :: Int -> ReadS ServiceActionAssociation
Prelude.Read, Int -> ServiceActionAssociation -> ShowS
[ServiceActionAssociation] -> ShowS
ServiceActionAssociation -> String
(Int -> ServiceActionAssociation -> ShowS)
-> (ServiceActionAssociation -> String)
-> ([ServiceActionAssociation] -> ShowS)
-> Show ServiceActionAssociation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ServiceActionAssociation] -> ShowS
$cshowList :: [ServiceActionAssociation] -> ShowS
show :: ServiceActionAssociation -> String
$cshow :: ServiceActionAssociation -> String
showsPrec :: Int -> ServiceActionAssociation -> ShowS
$cshowsPrec :: Int -> ServiceActionAssociation -> ShowS
Prelude.Show, (forall x.
 ServiceActionAssociation -> Rep ServiceActionAssociation x)
-> (forall x.
    Rep ServiceActionAssociation x -> ServiceActionAssociation)
-> Generic ServiceActionAssociation
forall x.
Rep ServiceActionAssociation x -> ServiceActionAssociation
forall x.
ServiceActionAssociation -> Rep ServiceActionAssociation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ServiceActionAssociation x -> ServiceActionAssociation
$cfrom :: forall x.
ServiceActionAssociation -> Rep ServiceActionAssociation x
Prelude.Generic)

-- |
-- Create a value of 'ServiceActionAssociation' 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:
--
-- 'serviceActionId', 'serviceActionAssociation_serviceActionId' - The self-service action identifier. For example, @act-fs7abcd89wxyz@.
--
-- 'productId', 'serviceActionAssociation_productId' - The product identifier. For example, @prod-abcdzk7xy33qa@.
--
-- 'provisioningArtifactId', 'serviceActionAssociation_provisioningArtifactId' - The identifier of the provisioning artifact. For example,
-- @pa-4abcdjnxjj6ne@.
newServiceActionAssociation ::
  -- | 'serviceActionId'
  Prelude.Text ->
  -- | 'productId'
  Prelude.Text ->
  -- | 'provisioningArtifactId'
  Prelude.Text ->
  ServiceActionAssociation
newServiceActionAssociation :: Text -> Text -> Text -> ServiceActionAssociation
newServiceActionAssociation
  Text
pServiceActionId_
  Text
pProductId_
  Text
pProvisioningArtifactId_ =
    ServiceActionAssociation' :: Text -> Text -> Text -> ServiceActionAssociation
ServiceActionAssociation'
      { $sel:serviceActionId:ServiceActionAssociation' :: Text
serviceActionId =
          Text
pServiceActionId_,
        $sel:productId:ServiceActionAssociation' :: Text
productId = Text
pProductId_,
        $sel:provisioningArtifactId:ServiceActionAssociation' :: Text
provisioningArtifactId = Text
pProvisioningArtifactId_
      }

-- | The self-service action identifier. For example, @act-fs7abcd89wxyz@.
serviceActionAssociation_serviceActionId :: Lens.Lens' ServiceActionAssociation Prelude.Text
serviceActionAssociation_serviceActionId :: (Text -> f Text)
-> ServiceActionAssociation -> f ServiceActionAssociation
serviceActionAssociation_serviceActionId = (ServiceActionAssociation -> Text)
-> (ServiceActionAssociation -> Text -> ServiceActionAssociation)
-> Lens ServiceActionAssociation ServiceActionAssociation Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceActionAssociation' {Text
serviceActionId :: Text
$sel:serviceActionId:ServiceActionAssociation' :: ServiceActionAssociation -> Text
serviceActionId} -> Text
serviceActionId) (\s :: ServiceActionAssociation
s@ServiceActionAssociation' {} Text
a -> ServiceActionAssociation
s {$sel:serviceActionId:ServiceActionAssociation' :: Text
serviceActionId = Text
a} :: ServiceActionAssociation)

-- | The product identifier. For example, @prod-abcdzk7xy33qa@.
serviceActionAssociation_productId :: Lens.Lens' ServiceActionAssociation Prelude.Text
serviceActionAssociation_productId :: (Text -> f Text)
-> ServiceActionAssociation -> f ServiceActionAssociation
serviceActionAssociation_productId = (ServiceActionAssociation -> Text)
-> (ServiceActionAssociation -> Text -> ServiceActionAssociation)
-> Lens ServiceActionAssociation ServiceActionAssociation Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceActionAssociation' {Text
productId :: Text
$sel:productId:ServiceActionAssociation' :: ServiceActionAssociation -> Text
productId} -> Text
productId) (\s :: ServiceActionAssociation
s@ServiceActionAssociation' {} Text
a -> ServiceActionAssociation
s {$sel:productId:ServiceActionAssociation' :: Text
productId = Text
a} :: ServiceActionAssociation)

-- | The identifier of the provisioning artifact. For example,
-- @pa-4abcdjnxjj6ne@.
serviceActionAssociation_provisioningArtifactId :: Lens.Lens' ServiceActionAssociation Prelude.Text
serviceActionAssociation_provisioningArtifactId :: (Text -> f Text)
-> ServiceActionAssociation -> f ServiceActionAssociation
serviceActionAssociation_provisioningArtifactId = (ServiceActionAssociation -> Text)
-> (ServiceActionAssociation -> Text -> ServiceActionAssociation)
-> Lens ServiceActionAssociation ServiceActionAssociation Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceActionAssociation' {Text
provisioningArtifactId :: Text
$sel:provisioningArtifactId:ServiceActionAssociation' :: ServiceActionAssociation -> Text
provisioningArtifactId} -> Text
provisioningArtifactId) (\s :: ServiceActionAssociation
s@ServiceActionAssociation' {} Text
a -> ServiceActionAssociation
s {$sel:provisioningArtifactId:ServiceActionAssociation' :: Text
provisioningArtifactId = Text
a} :: ServiceActionAssociation)

instance Prelude.Hashable ServiceActionAssociation

instance Prelude.NFData ServiceActionAssociation

instance Core.ToJSON ServiceActionAssociation where
  toJSON :: ServiceActionAssociation -> Value
toJSON ServiceActionAssociation' {Text
provisioningArtifactId :: Text
productId :: Text
serviceActionId :: Text
$sel:provisioningArtifactId:ServiceActionAssociation' :: ServiceActionAssociation -> Text
$sel:productId:ServiceActionAssociation' :: ServiceActionAssociation -> Text
$sel:serviceActionId:ServiceActionAssociation' :: ServiceActionAssociation -> 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
"ServiceActionId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
serviceActionId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ProductId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
productId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"ProvisioningArtifactId"
                  Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
provisioningArtifactId
              )
          ]
      )