{-# 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.VariantProperty
-- 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.VariantProperty where

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

-- | Specifies a production variant property type for an Endpoint.
--
-- If you are updating an endpoint with the
-- UpdateEndpointInput$RetainAllVariantProperties option set to @true@, the
-- @VariantProperty@ objects listed in
-- UpdateEndpointInput$ExcludeRetainedVariantProperties override the
-- existing variant properties of the endpoint.
--
-- /See:/ 'newVariantProperty' smart constructor.
data VariantProperty = VariantProperty'
  { -- | The type of variant property. The supported values are:
    --
    -- -   @DesiredInstanceCount@: Overrides the existing variant instance
    --     counts using the ProductionVariant$InitialInstanceCount values in
    --     the CreateEndpointConfigInput$ProductionVariants.
    --
    -- -   @DesiredWeight@: Overrides the existing variant weights using the
    --     ProductionVariant$InitialVariantWeight values in the
    --     CreateEndpointConfigInput$ProductionVariants.
    --
    -- -   @DataCaptureConfig@: (Not currently supported.)
    VariantProperty -> VariantPropertyType
variantPropertyType :: VariantPropertyType
  }
  deriving (VariantProperty -> VariantProperty -> Bool
(VariantProperty -> VariantProperty -> Bool)
-> (VariantProperty -> VariantProperty -> Bool)
-> Eq VariantProperty
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VariantProperty -> VariantProperty -> Bool
$c/= :: VariantProperty -> VariantProperty -> Bool
== :: VariantProperty -> VariantProperty -> Bool
$c== :: VariantProperty -> VariantProperty -> Bool
Prelude.Eq, ReadPrec [VariantProperty]
ReadPrec VariantProperty
Int -> ReadS VariantProperty
ReadS [VariantProperty]
(Int -> ReadS VariantProperty)
-> ReadS [VariantProperty]
-> ReadPrec VariantProperty
-> ReadPrec [VariantProperty]
-> Read VariantProperty
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VariantProperty]
$creadListPrec :: ReadPrec [VariantProperty]
readPrec :: ReadPrec VariantProperty
$creadPrec :: ReadPrec VariantProperty
readList :: ReadS [VariantProperty]
$creadList :: ReadS [VariantProperty]
readsPrec :: Int -> ReadS VariantProperty
$creadsPrec :: Int -> ReadS VariantProperty
Prelude.Read, Int -> VariantProperty -> ShowS
[VariantProperty] -> ShowS
VariantProperty -> String
(Int -> VariantProperty -> ShowS)
-> (VariantProperty -> String)
-> ([VariantProperty] -> ShowS)
-> Show VariantProperty
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VariantProperty] -> ShowS
$cshowList :: [VariantProperty] -> ShowS
show :: VariantProperty -> String
$cshow :: VariantProperty -> String
showsPrec :: Int -> VariantProperty -> ShowS
$cshowsPrec :: Int -> VariantProperty -> ShowS
Prelude.Show, (forall x. VariantProperty -> Rep VariantProperty x)
-> (forall x. Rep VariantProperty x -> VariantProperty)
-> Generic VariantProperty
forall x. Rep VariantProperty x -> VariantProperty
forall x. VariantProperty -> Rep VariantProperty x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep VariantProperty x -> VariantProperty
$cfrom :: forall x. VariantProperty -> Rep VariantProperty x
Prelude.Generic)

-- |
-- Create a value of 'VariantProperty' 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:
--
-- 'variantPropertyType', 'variantProperty_variantPropertyType' - The type of variant property. The supported values are:
--
-- -   @DesiredInstanceCount@: Overrides the existing variant instance
--     counts using the ProductionVariant$InitialInstanceCount values in
--     the CreateEndpointConfigInput$ProductionVariants.
--
-- -   @DesiredWeight@: Overrides the existing variant weights using the
--     ProductionVariant$InitialVariantWeight values in the
--     CreateEndpointConfigInput$ProductionVariants.
--
-- -   @DataCaptureConfig@: (Not currently supported.)
newVariantProperty ::
  -- | 'variantPropertyType'
  VariantPropertyType ->
  VariantProperty
newVariantProperty :: VariantPropertyType -> VariantProperty
newVariantProperty VariantPropertyType
pVariantPropertyType_ =
  VariantProperty' :: VariantPropertyType -> VariantProperty
VariantProperty'
    { $sel:variantPropertyType:VariantProperty' :: VariantPropertyType
variantPropertyType =
        VariantPropertyType
pVariantPropertyType_
    }

-- | The type of variant property. The supported values are:
--
-- -   @DesiredInstanceCount@: Overrides the existing variant instance
--     counts using the ProductionVariant$InitialInstanceCount values in
--     the CreateEndpointConfigInput$ProductionVariants.
--
-- -   @DesiredWeight@: Overrides the existing variant weights using the
--     ProductionVariant$InitialVariantWeight values in the
--     CreateEndpointConfigInput$ProductionVariants.
--
-- -   @DataCaptureConfig@: (Not currently supported.)
variantProperty_variantPropertyType :: Lens.Lens' VariantProperty VariantPropertyType
variantProperty_variantPropertyType :: (VariantPropertyType -> f VariantPropertyType)
-> VariantProperty -> f VariantProperty
variantProperty_variantPropertyType = (VariantProperty -> VariantPropertyType)
-> (VariantProperty -> VariantPropertyType -> VariantProperty)
-> Lens
     VariantProperty
     VariantProperty
     VariantPropertyType
     VariantPropertyType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VariantProperty' {VariantPropertyType
variantPropertyType :: VariantPropertyType
$sel:variantPropertyType:VariantProperty' :: VariantProperty -> VariantPropertyType
variantPropertyType} -> VariantPropertyType
variantPropertyType) (\s :: VariantProperty
s@VariantProperty' {} VariantPropertyType
a -> VariantProperty
s {$sel:variantPropertyType:VariantProperty' :: VariantPropertyType
variantPropertyType = VariantPropertyType
a} :: VariantProperty)

instance Prelude.Hashable VariantProperty

instance Prelude.NFData VariantProperty

instance Core.ToJSON VariantProperty where
  toJSON :: VariantProperty -> Value
toJSON VariantProperty' {VariantPropertyType
variantPropertyType :: VariantPropertyType
$sel:variantPropertyType:VariantProperty' :: VariantProperty -> VariantPropertyType
..} =
    [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
"VariantPropertyType" Text -> VariantPropertyType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= VariantPropertyType
variantPropertyType)
          ]
      )