{-# 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.SageMaker.Types.ServiceCatalogProvisioningDetails
-- 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.SageMaker.Types.ServiceCatalogProvisioningDetails where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SageMaker.Types.ProvisioningParameter

-- | Details that you specify to provision a service catalog product. For
-- information about service catalog, see
-- <https://docs.aws.amazon.com/servicecatalog/latest/adminguide/introduction.html What is Amazon Web Services Service Catalog>.
--
-- /See:/ 'newServiceCatalogProvisioningDetails' smart constructor.
data ServiceCatalogProvisioningDetails = ServiceCatalogProvisioningDetails'
  { -- | The ID of the provisioning artifact.
    ServiceCatalogProvisioningDetails -> Maybe Text
provisioningArtifactId :: Prelude.Maybe Prelude.Text,
    -- | The path identifier of the product. This value is optional if the
    -- product has a default path, and required if the product has more than
    -- one path.
    ServiceCatalogProvisioningDetails -> Maybe Text
pathId :: Prelude.Maybe Prelude.Text,
    -- | A list of key value pairs that you specify when you provision a product.
    ServiceCatalogProvisioningDetails -> Maybe [ProvisioningParameter]
provisioningParameters :: Prelude.Maybe [ProvisioningParameter],
    -- | The ID of the product to provision.
    ServiceCatalogProvisioningDetails -> Text
productId :: Prelude.Text
  }
  deriving (ServiceCatalogProvisioningDetails
-> ServiceCatalogProvisioningDetails -> Bool
(ServiceCatalogProvisioningDetails
 -> ServiceCatalogProvisioningDetails -> Bool)
-> (ServiceCatalogProvisioningDetails
    -> ServiceCatalogProvisioningDetails -> Bool)
-> Eq ServiceCatalogProvisioningDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ServiceCatalogProvisioningDetails
-> ServiceCatalogProvisioningDetails -> Bool
$c/= :: ServiceCatalogProvisioningDetails
-> ServiceCatalogProvisioningDetails -> Bool
== :: ServiceCatalogProvisioningDetails
-> ServiceCatalogProvisioningDetails -> Bool
$c== :: ServiceCatalogProvisioningDetails
-> ServiceCatalogProvisioningDetails -> Bool
Prelude.Eq, ReadPrec [ServiceCatalogProvisioningDetails]
ReadPrec ServiceCatalogProvisioningDetails
Int -> ReadS ServiceCatalogProvisioningDetails
ReadS [ServiceCatalogProvisioningDetails]
(Int -> ReadS ServiceCatalogProvisioningDetails)
-> ReadS [ServiceCatalogProvisioningDetails]
-> ReadPrec ServiceCatalogProvisioningDetails
-> ReadPrec [ServiceCatalogProvisioningDetails]
-> Read ServiceCatalogProvisioningDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ServiceCatalogProvisioningDetails]
$creadListPrec :: ReadPrec [ServiceCatalogProvisioningDetails]
readPrec :: ReadPrec ServiceCatalogProvisioningDetails
$creadPrec :: ReadPrec ServiceCatalogProvisioningDetails
readList :: ReadS [ServiceCatalogProvisioningDetails]
$creadList :: ReadS [ServiceCatalogProvisioningDetails]
readsPrec :: Int -> ReadS ServiceCatalogProvisioningDetails
$creadsPrec :: Int -> ReadS ServiceCatalogProvisioningDetails
Prelude.Read, Int -> ServiceCatalogProvisioningDetails -> ShowS
[ServiceCatalogProvisioningDetails] -> ShowS
ServiceCatalogProvisioningDetails -> String
(Int -> ServiceCatalogProvisioningDetails -> ShowS)
-> (ServiceCatalogProvisioningDetails -> String)
-> ([ServiceCatalogProvisioningDetails] -> ShowS)
-> Show ServiceCatalogProvisioningDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ServiceCatalogProvisioningDetails] -> ShowS
$cshowList :: [ServiceCatalogProvisioningDetails] -> ShowS
show :: ServiceCatalogProvisioningDetails -> String
$cshow :: ServiceCatalogProvisioningDetails -> String
showsPrec :: Int -> ServiceCatalogProvisioningDetails -> ShowS
$cshowsPrec :: Int -> ServiceCatalogProvisioningDetails -> ShowS
Prelude.Show, (forall x.
 ServiceCatalogProvisioningDetails
 -> Rep ServiceCatalogProvisioningDetails x)
-> (forall x.
    Rep ServiceCatalogProvisioningDetails x
    -> ServiceCatalogProvisioningDetails)
-> Generic ServiceCatalogProvisioningDetails
forall x.
Rep ServiceCatalogProvisioningDetails x
-> ServiceCatalogProvisioningDetails
forall x.
ServiceCatalogProvisioningDetails
-> Rep ServiceCatalogProvisioningDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ServiceCatalogProvisioningDetails x
-> ServiceCatalogProvisioningDetails
$cfrom :: forall x.
ServiceCatalogProvisioningDetails
-> Rep ServiceCatalogProvisioningDetails x
Prelude.Generic)

-- |
-- Create a value of 'ServiceCatalogProvisioningDetails' 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:
--
-- 'provisioningArtifactId', 'serviceCatalogProvisioningDetails_provisioningArtifactId' - The ID of the provisioning artifact.
--
-- 'pathId', 'serviceCatalogProvisioningDetails_pathId' - The path identifier of the product. This value is optional if the
-- product has a default path, and required if the product has more than
-- one path.
--
-- 'provisioningParameters', 'serviceCatalogProvisioningDetails_provisioningParameters' - A list of key value pairs that you specify when you provision a product.
--
-- 'productId', 'serviceCatalogProvisioningDetails_productId' - The ID of the product to provision.
newServiceCatalogProvisioningDetails ::
  -- | 'productId'
  Prelude.Text ->
  ServiceCatalogProvisioningDetails
newServiceCatalogProvisioningDetails :: Text -> ServiceCatalogProvisioningDetails
newServiceCatalogProvisioningDetails Text
pProductId_ =
  ServiceCatalogProvisioningDetails' :: Maybe Text
-> Maybe Text
-> Maybe [ProvisioningParameter]
-> Text
-> ServiceCatalogProvisioningDetails
ServiceCatalogProvisioningDetails'
    { $sel:provisioningArtifactId:ServiceCatalogProvisioningDetails' :: Maybe Text
provisioningArtifactId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:pathId:ServiceCatalogProvisioningDetails' :: Maybe Text
pathId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:provisioningParameters:ServiceCatalogProvisioningDetails' :: Maybe [ProvisioningParameter]
provisioningParameters = Maybe [ProvisioningParameter]
forall a. Maybe a
Prelude.Nothing,
      $sel:productId:ServiceCatalogProvisioningDetails' :: Text
productId = Text
pProductId_
    }

-- | The ID of the provisioning artifact.
serviceCatalogProvisioningDetails_provisioningArtifactId :: Lens.Lens' ServiceCatalogProvisioningDetails (Prelude.Maybe Prelude.Text)
serviceCatalogProvisioningDetails_provisioningArtifactId :: (Maybe Text -> f (Maybe Text))
-> ServiceCatalogProvisioningDetails
-> f ServiceCatalogProvisioningDetails
serviceCatalogProvisioningDetails_provisioningArtifactId = (ServiceCatalogProvisioningDetails -> Maybe Text)
-> (ServiceCatalogProvisioningDetails
    -> Maybe Text -> ServiceCatalogProvisioningDetails)
-> Lens
     ServiceCatalogProvisioningDetails
     ServiceCatalogProvisioningDetails
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceCatalogProvisioningDetails' {Maybe Text
provisioningArtifactId :: Maybe Text
$sel:provisioningArtifactId:ServiceCatalogProvisioningDetails' :: ServiceCatalogProvisioningDetails -> Maybe Text
provisioningArtifactId} -> Maybe Text
provisioningArtifactId) (\s :: ServiceCatalogProvisioningDetails
s@ServiceCatalogProvisioningDetails' {} Maybe Text
a -> ServiceCatalogProvisioningDetails
s {$sel:provisioningArtifactId:ServiceCatalogProvisioningDetails' :: Maybe Text
provisioningArtifactId = Maybe Text
a} :: ServiceCatalogProvisioningDetails)

-- | The path identifier of the product. This value is optional if the
-- product has a default path, and required if the product has more than
-- one path.
serviceCatalogProvisioningDetails_pathId :: Lens.Lens' ServiceCatalogProvisioningDetails (Prelude.Maybe Prelude.Text)
serviceCatalogProvisioningDetails_pathId :: (Maybe Text -> f (Maybe Text))
-> ServiceCatalogProvisioningDetails
-> f ServiceCatalogProvisioningDetails
serviceCatalogProvisioningDetails_pathId = (ServiceCatalogProvisioningDetails -> Maybe Text)
-> (ServiceCatalogProvisioningDetails
    -> Maybe Text -> ServiceCatalogProvisioningDetails)
-> Lens
     ServiceCatalogProvisioningDetails
     ServiceCatalogProvisioningDetails
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceCatalogProvisioningDetails' {Maybe Text
pathId :: Maybe Text
$sel:pathId:ServiceCatalogProvisioningDetails' :: ServiceCatalogProvisioningDetails -> Maybe Text
pathId} -> Maybe Text
pathId) (\s :: ServiceCatalogProvisioningDetails
s@ServiceCatalogProvisioningDetails' {} Maybe Text
a -> ServiceCatalogProvisioningDetails
s {$sel:pathId:ServiceCatalogProvisioningDetails' :: Maybe Text
pathId = Maybe Text
a} :: ServiceCatalogProvisioningDetails)

-- | A list of key value pairs that you specify when you provision a product.
serviceCatalogProvisioningDetails_provisioningParameters :: Lens.Lens' ServiceCatalogProvisioningDetails (Prelude.Maybe [ProvisioningParameter])
serviceCatalogProvisioningDetails_provisioningParameters :: (Maybe [ProvisioningParameter]
 -> f (Maybe [ProvisioningParameter]))
-> ServiceCatalogProvisioningDetails
-> f ServiceCatalogProvisioningDetails
serviceCatalogProvisioningDetails_provisioningParameters = (ServiceCatalogProvisioningDetails
 -> Maybe [ProvisioningParameter])
-> (ServiceCatalogProvisioningDetails
    -> Maybe [ProvisioningParameter]
    -> ServiceCatalogProvisioningDetails)
-> Lens
     ServiceCatalogProvisioningDetails
     ServiceCatalogProvisioningDetails
     (Maybe [ProvisioningParameter])
     (Maybe [ProvisioningParameter])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceCatalogProvisioningDetails' {Maybe [ProvisioningParameter]
provisioningParameters :: Maybe [ProvisioningParameter]
$sel:provisioningParameters:ServiceCatalogProvisioningDetails' :: ServiceCatalogProvisioningDetails -> Maybe [ProvisioningParameter]
provisioningParameters} -> Maybe [ProvisioningParameter]
provisioningParameters) (\s :: ServiceCatalogProvisioningDetails
s@ServiceCatalogProvisioningDetails' {} Maybe [ProvisioningParameter]
a -> ServiceCatalogProvisioningDetails
s {$sel:provisioningParameters:ServiceCatalogProvisioningDetails' :: Maybe [ProvisioningParameter]
provisioningParameters = Maybe [ProvisioningParameter]
a} :: ServiceCatalogProvisioningDetails) ((Maybe [ProvisioningParameter]
  -> f (Maybe [ProvisioningParameter]))
 -> ServiceCatalogProvisioningDetails
 -> f ServiceCatalogProvisioningDetails)
-> ((Maybe [ProvisioningParameter]
     -> f (Maybe [ProvisioningParameter]))
    -> Maybe [ProvisioningParameter]
    -> f (Maybe [ProvisioningParameter]))
-> (Maybe [ProvisioningParameter]
    -> f (Maybe [ProvisioningParameter]))
-> ServiceCatalogProvisioningDetails
-> f ServiceCatalogProvisioningDetails
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ProvisioningParameter]
  [ProvisioningParameter]
  [ProvisioningParameter]
  [ProvisioningParameter]
-> Iso
     (Maybe [ProvisioningParameter])
     (Maybe [ProvisioningParameter])
     (Maybe [ProvisioningParameter])
     (Maybe [ProvisioningParameter])
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
  [ProvisioningParameter]
  [ProvisioningParameter]
  [ProvisioningParameter]
  [ProvisioningParameter]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The ID of the product to provision.
serviceCatalogProvisioningDetails_productId :: Lens.Lens' ServiceCatalogProvisioningDetails Prelude.Text
serviceCatalogProvisioningDetails_productId :: (Text -> f Text)
-> ServiceCatalogProvisioningDetails
-> f ServiceCatalogProvisioningDetails
serviceCatalogProvisioningDetails_productId = (ServiceCatalogProvisioningDetails -> Text)
-> (ServiceCatalogProvisioningDetails
    -> Text -> ServiceCatalogProvisioningDetails)
-> Lens
     ServiceCatalogProvisioningDetails
     ServiceCatalogProvisioningDetails
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceCatalogProvisioningDetails' {Text
productId :: Text
$sel:productId:ServiceCatalogProvisioningDetails' :: ServiceCatalogProvisioningDetails -> Text
productId} -> Text
productId) (\s :: ServiceCatalogProvisioningDetails
s@ServiceCatalogProvisioningDetails' {} Text
a -> ServiceCatalogProvisioningDetails
s {$sel:productId:ServiceCatalogProvisioningDetails' :: Text
productId = Text
a} :: ServiceCatalogProvisioningDetails)

instance
  Core.FromJSON
    ServiceCatalogProvisioningDetails
  where
  parseJSON :: Value -> Parser ServiceCatalogProvisioningDetails
parseJSON =
    String
-> (Object -> Parser ServiceCatalogProvisioningDetails)
-> Value
-> Parser ServiceCatalogProvisioningDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ServiceCatalogProvisioningDetails"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe [ProvisioningParameter]
-> Text
-> ServiceCatalogProvisioningDetails
ServiceCatalogProvisioningDetails'
            (Maybe Text
 -> Maybe Text
 -> Maybe [ProvisioningParameter]
 -> Text
 -> ServiceCatalogProvisioningDetails)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe [ProvisioningParameter]
      -> Text
      -> ServiceCatalogProvisioningDetails)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ProvisioningArtifactId")
            Parser
  (Maybe Text
   -> Maybe [ProvisioningParameter]
   -> Text
   -> ServiceCatalogProvisioningDetails)
-> Parser (Maybe Text)
-> Parser
     (Maybe [ProvisioningParameter]
      -> Text -> ServiceCatalogProvisioningDetails)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"PathId")
            Parser
  (Maybe [ProvisioningParameter]
   -> Text -> ServiceCatalogProvisioningDetails)
-> Parser (Maybe [ProvisioningParameter])
-> Parser (Text -> ServiceCatalogProvisioningDetails)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [ProvisioningParameter]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ProvisioningParameters"
                            Parser (Maybe (Maybe [ProvisioningParameter]))
-> Maybe [ProvisioningParameter]
-> Parser (Maybe [ProvisioningParameter])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [ProvisioningParameter]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser (Text -> ServiceCatalogProvisioningDetails)
-> Parser Text -> Parser ServiceCatalogProvisioningDetails
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"ProductId")
      )

instance
  Prelude.Hashable
    ServiceCatalogProvisioningDetails

instance
  Prelude.NFData
    ServiceCatalogProvisioningDetails

instance
  Core.ToJSON
    ServiceCatalogProvisioningDetails
  where
  toJSON :: ServiceCatalogProvisioningDetails -> Value
toJSON ServiceCatalogProvisioningDetails' {Maybe [ProvisioningParameter]
Maybe Text
Text
productId :: Text
provisioningParameters :: Maybe [ProvisioningParameter]
pathId :: Maybe Text
provisioningArtifactId :: Maybe Text
$sel:productId:ServiceCatalogProvisioningDetails' :: ServiceCatalogProvisioningDetails -> Text
$sel:provisioningParameters:ServiceCatalogProvisioningDetails' :: ServiceCatalogProvisioningDetails -> Maybe [ProvisioningParameter]
$sel:pathId:ServiceCatalogProvisioningDetails' :: ServiceCatalogProvisioningDetails -> Maybe Text
$sel:provisioningArtifactId:ServiceCatalogProvisioningDetails' :: ServiceCatalogProvisioningDetails -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"ProvisioningArtifactId" 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
provisioningArtifactId,
            (Text
"PathId" 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
pathId,
            (Text
"ProvisioningParameters" Text -> [ProvisioningParameter] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([ProvisioningParameter] -> Pair)
-> Maybe [ProvisioningParameter] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [ProvisioningParameter]
provisioningParameters,
            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)
          ]
      )