{-# 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.ComputeOptimizer.PutRecommendationPreferences
-- 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 a new recommendation preference or updates an existing
-- recommendation preference, such as enhanced infrastructure metrics.
--
-- For more information, see
-- <https://docs.aws.amazon.com/compute-optimizer/latest/ug/enhanced-infrastructure-metrics.html Activating enhanced infrastructure metrics>
-- in the /Compute Optimizer User Guide/.
module Amazonka.ComputeOptimizer.PutRecommendationPreferences
  ( -- * Creating a Request
    PutRecommendationPreferences (..),
    newPutRecommendationPreferences,

    -- * Request Lenses
    putRecommendationPreferences_enhancedInfrastructureMetrics,
    putRecommendationPreferences_externalMetricsPreference,
    putRecommendationPreferences_inferredWorkloadTypes,
    putRecommendationPreferences_scope,
    putRecommendationPreferences_resourceType,

    -- * Destructuring the Response
    PutRecommendationPreferencesResponse (..),
    newPutRecommendationPreferencesResponse,

    -- * Response Lenses
    putRecommendationPreferencesResponse_httpStatus,
  )
where

import Amazonka.ComputeOptimizer.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:/ 'newPutRecommendationPreferences' smart constructor.
data PutRecommendationPreferences = PutRecommendationPreferences'
  { -- | The status of the enhanced infrastructure metrics recommendation
    -- preference to create or update.
    --
    -- Specify the @Active@ status to activate the preference, or specify
    -- @Inactive@ to deactivate the preference.
    --
    -- For more information, see
    -- <https://docs.aws.amazon.com/compute-optimizer/latest/ug/enhanced-infrastructure-metrics.html Enhanced infrastructure metrics>
    -- in the /Compute Optimizer User Guide/.
    PutRecommendationPreferences -> Maybe EnhancedInfrastructureMetrics
enhancedInfrastructureMetrics :: Prelude.Maybe EnhancedInfrastructureMetrics,
    -- | The provider of the external metrics recommendation preference to create
    -- or update.
    --
    -- Specify a valid provider in the @source@ field to activate the
    -- preference. To delete this preference, see the
    -- DeleteRecommendationPreferences action.
    --
    -- This preference can only be set for the @Ec2Instance@ resource type.
    --
    -- For more information, see
    -- <https://docs.aws.amazon.com/compute-optimizer/latest/ug/external-metrics-ingestion.html External metrics ingestion>
    -- in the /Compute Optimizer User Guide/.
    PutRecommendationPreferences -> Maybe ExternalMetricsPreference
externalMetricsPreference :: Prelude.Maybe ExternalMetricsPreference,
    -- | The status of the inferred workload types recommendation preference to
    -- create or update.
    --
    -- The inferred workload type feature is active by default. To deactivate
    -- it, create a recommendation preference.
    --
    -- Specify the @Inactive@ status to deactivate the feature, or specify
    -- @Active@ to activate it.
    --
    -- For more information, see
    -- <https://docs.aws.amazon.com/compute-optimizer/latest/ug/inferred-workload-types.html Inferred workload types>
    -- in the /Compute Optimizer User Guide/.
    PutRecommendationPreferences
-> Maybe InferredWorkloadTypesPreference
inferredWorkloadTypes :: Prelude.Maybe InferredWorkloadTypesPreference,
    -- | An object that describes the scope of the recommendation preference to
    -- create.
    --
    -- You can create recommendation preferences at the organization level (for
    -- management accounts of an organization only), account level, and
    -- resource level. For more information, see
    -- <https://docs.aws.amazon.com/compute-optimizer/latest/ug/enhanced-infrastructure-metrics.html Activating enhanced infrastructure metrics>
    -- in the /Compute Optimizer User Guide/.
    --
    -- You cannot create recommendation preferences for Auto Scaling groups at
    -- the organization and account levels. You can create recommendation
    -- preferences for Auto Scaling groups only at the resource level by
    -- specifying a scope name of @ResourceArn@ and a scope value of the Auto
    -- Scaling group Amazon Resource Name (ARN). This will configure the
    -- preference for all instances that are part of the specified Auto Scaling
    -- group. You also cannot create recommendation preferences at the resource
    -- level for instances that are part of an Auto Scaling group. You can
    -- create recommendation preferences at the resource level only for
    -- standalone instances.
    PutRecommendationPreferences -> Maybe Scope
scope :: Prelude.Maybe Scope,
    -- | The target resource type of the recommendation preference to create.
    --
    -- The @Ec2Instance@ option encompasses standalone instances and instances
    -- that are part of Auto Scaling groups. The @AutoScalingGroup@ option
    -- encompasses only instances that are part of an Auto Scaling group.
    --
    -- The valid values for this parameter are @Ec2Instance@ and
    -- @AutoScalingGroup@.
    PutRecommendationPreferences -> ResourceType
resourceType :: ResourceType
  }
  deriving (PutRecommendationPreferences
-> PutRecommendationPreferences -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutRecommendationPreferences
-> PutRecommendationPreferences -> Bool
$c/= :: PutRecommendationPreferences
-> PutRecommendationPreferences -> Bool
== :: PutRecommendationPreferences
-> PutRecommendationPreferences -> Bool
$c== :: PutRecommendationPreferences
-> PutRecommendationPreferences -> Bool
Prelude.Eq, ReadPrec [PutRecommendationPreferences]
ReadPrec PutRecommendationPreferences
Int -> ReadS PutRecommendationPreferences
ReadS [PutRecommendationPreferences]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutRecommendationPreferences]
$creadListPrec :: ReadPrec [PutRecommendationPreferences]
readPrec :: ReadPrec PutRecommendationPreferences
$creadPrec :: ReadPrec PutRecommendationPreferences
readList :: ReadS [PutRecommendationPreferences]
$creadList :: ReadS [PutRecommendationPreferences]
readsPrec :: Int -> ReadS PutRecommendationPreferences
$creadsPrec :: Int -> ReadS PutRecommendationPreferences
Prelude.Read, Int -> PutRecommendationPreferences -> ShowS
[PutRecommendationPreferences] -> ShowS
PutRecommendationPreferences -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutRecommendationPreferences] -> ShowS
$cshowList :: [PutRecommendationPreferences] -> ShowS
show :: PutRecommendationPreferences -> String
$cshow :: PutRecommendationPreferences -> String
showsPrec :: Int -> PutRecommendationPreferences -> ShowS
$cshowsPrec :: Int -> PutRecommendationPreferences -> ShowS
Prelude.Show, forall x.
Rep PutRecommendationPreferences x -> PutRecommendationPreferences
forall x.
PutRecommendationPreferences -> Rep PutRecommendationPreferences x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutRecommendationPreferences x -> PutRecommendationPreferences
$cfrom :: forall x.
PutRecommendationPreferences -> Rep PutRecommendationPreferences x
Prelude.Generic)

-- |
-- Create a value of 'PutRecommendationPreferences' 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:
--
-- 'enhancedInfrastructureMetrics', 'putRecommendationPreferences_enhancedInfrastructureMetrics' - The status of the enhanced infrastructure metrics recommendation
-- preference to create or update.
--
-- Specify the @Active@ status to activate the preference, or specify
-- @Inactive@ to deactivate the preference.
--
-- For more information, see
-- <https://docs.aws.amazon.com/compute-optimizer/latest/ug/enhanced-infrastructure-metrics.html Enhanced infrastructure metrics>
-- in the /Compute Optimizer User Guide/.
--
-- 'externalMetricsPreference', 'putRecommendationPreferences_externalMetricsPreference' - The provider of the external metrics recommendation preference to create
-- or update.
--
-- Specify a valid provider in the @source@ field to activate the
-- preference. To delete this preference, see the
-- DeleteRecommendationPreferences action.
--
-- This preference can only be set for the @Ec2Instance@ resource type.
--
-- For more information, see
-- <https://docs.aws.amazon.com/compute-optimizer/latest/ug/external-metrics-ingestion.html External metrics ingestion>
-- in the /Compute Optimizer User Guide/.
--
-- 'inferredWorkloadTypes', 'putRecommendationPreferences_inferredWorkloadTypes' - The status of the inferred workload types recommendation preference to
-- create or update.
--
-- The inferred workload type feature is active by default. To deactivate
-- it, create a recommendation preference.
--
-- Specify the @Inactive@ status to deactivate the feature, or specify
-- @Active@ to activate it.
--
-- For more information, see
-- <https://docs.aws.amazon.com/compute-optimizer/latest/ug/inferred-workload-types.html Inferred workload types>
-- in the /Compute Optimizer User Guide/.
--
-- 'scope', 'putRecommendationPreferences_scope' - An object that describes the scope of the recommendation preference to
-- create.
--
-- You can create recommendation preferences at the organization level (for
-- management accounts of an organization only), account level, and
-- resource level. For more information, see
-- <https://docs.aws.amazon.com/compute-optimizer/latest/ug/enhanced-infrastructure-metrics.html Activating enhanced infrastructure metrics>
-- in the /Compute Optimizer User Guide/.
--
-- You cannot create recommendation preferences for Auto Scaling groups at
-- the organization and account levels. You can create recommendation
-- preferences for Auto Scaling groups only at the resource level by
-- specifying a scope name of @ResourceArn@ and a scope value of the Auto
-- Scaling group Amazon Resource Name (ARN). This will configure the
-- preference for all instances that are part of the specified Auto Scaling
-- group. You also cannot create recommendation preferences at the resource
-- level for instances that are part of an Auto Scaling group. You can
-- create recommendation preferences at the resource level only for
-- standalone instances.
--
-- 'resourceType', 'putRecommendationPreferences_resourceType' - The target resource type of the recommendation preference to create.
--
-- The @Ec2Instance@ option encompasses standalone instances and instances
-- that are part of Auto Scaling groups. The @AutoScalingGroup@ option
-- encompasses only instances that are part of an Auto Scaling group.
--
-- The valid values for this parameter are @Ec2Instance@ and
-- @AutoScalingGroup@.
newPutRecommendationPreferences ::
  -- | 'resourceType'
  ResourceType ->
  PutRecommendationPreferences
newPutRecommendationPreferences :: ResourceType -> PutRecommendationPreferences
newPutRecommendationPreferences ResourceType
pResourceType_ =
  PutRecommendationPreferences'
    { $sel:enhancedInfrastructureMetrics:PutRecommendationPreferences' :: Maybe EnhancedInfrastructureMetrics
enhancedInfrastructureMetrics =
        forall a. Maybe a
Prelude.Nothing,
      $sel:externalMetricsPreference:PutRecommendationPreferences' :: Maybe ExternalMetricsPreference
externalMetricsPreference = forall a. Maybe a
Prelude.Nothing,
      $sel:inferredWorkloadTypes:PutRecommendationPreferences' :: Maybe InferredWorkloadTypesPreference
inferredWorkloadTypes = forall a. Maybe a
Prelude.Nothing,
      $sel:scope:PutRecommendationPreferences' :: Maybe Scope
scope = forall a. Maybe a
Prelude.Nothing,
      $sel:resourceType:PutRecommendationPreferences' :: ResourceType
resourceType = ResourceType
pResourceType_
    }

-- | The status of the enhanced infrastructure metrics recommendation
-- preference to create or update.
--
-- Specify the @Active@ status to activate the preference, or specify
-- @Inactive@ to deactivate the preference.
--
-- For more information, see
-- <https://docs.aws.amazon.com/compute-optimizer/latest/ug/enhanced-infrastructure-metrics.html Enhanced infrastructure metrics>
-- in the /Compute Optimizer User Guide/.
putRecommendationPreferences_enhancedInfrastructureMetrics :: Lens.Lens' PutRecommendationPreferences (Prelude.Maybe EnhancedInfrastructureMetrics)
putRecommendationPreferences_enhancedInfrastructureMetrics :: Lens'
  PutRecommendationPreferences (Maybe EnhancedInfrastructureMetrics)
putRecommendationPreferences_enhancedInfrastructureMetrics = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutRecommendationPreferences' {Maybe EnhancedInfrastructureMetrics
enhancedInfrastructureMetrics :: Maybe EnhancedInfrastructureMetrics
$sel:enhancedInfrastructureMetrics:PutRecommendationPreferences' :: PutRecommendationPreferences -> Maybe EnhancedInfrastructureMetrics
enhancedInfrastructureMetrics} -> Maybe EnhancedInfrastructureMetrics
enhancedInfrastructureMetrics) (\s :: PutRecommendationPreferences
s@PutRecommendationPreferences' {} Maybe EnhancedInfrastructureMetrics
a -> PutRecommendationPreferences
s {$sel:enhancedInfrastructureMetrics:PutRecommendationPreferences' :: Maybe EnhancedInfrastructureMetrics
enhancedInfrastructureMetrics = Maybe EnhancedInfrastructureMetrics
a} :: PutRecommendationPreferences)

-- | The provider of the external metrics recommendation preference to create
-- or update.
--
-- Specify a valid provider in the @source@ field to activate the
-- preference. To delete this preference, see the
-- DeleteRecommendationPreferences action.
--
-- This preference can only be set for the @Ec2Instance@ resource type.
--
-- For more information, see
-- <https://docs.aws.amazon.com/compute-optimizer/latest/ug/external-metrics-ingestion.html External metrics ingestion>
-- in the /Compute Optimizer User Guide/.
putRecommendationPreferences_externalMetricsPreference :: Lens.Lens' PutRecommendationPreferences (Prelude.Maybe ExternalMetricsPreference)
putRecommendationPreferences_externalMetricsPreference :: Lens'
  PutRecommendationPreferences (Maybe ExternalMetricsPreference)
putRecommendationPreferences_externalMetricsPreference = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutRecommendationPreferences' {Maybe ExternalMetricsPreference
externalMetricsPreference :: Maybe ExternalMetricsPreference
$sel:externalMetricsPreference:PutRecommendationPreferences' :: PutRecommendationPreferences -> Maybe ExternalMetricsPreference
externalMetricsPreference} -> Maybe ExternalMetricsPreference
externalMetricsPreference) (\s :: PutRecommendationPreferences
s@PutRecommendationPreferences' {} Maybe ExternalMetricsPreference
a -> PutRecommendationPreferences
s {$sel:externalMetricsPreference:PutRecommendationPreferences' :: Maybe ExternalMetricsPreference
externalMetricsPreference = Maybe ExternalMetricsPreference
a} :: PutRecommendationPreferences)

-- | The status of the inferred workload types recommendation preference to
-- create or update.
--
-- The inferred workload type feature is active by default. To deactivate
-- it, create a recommendation preference.
--
-- Specify the @Inactive@ status to deactivate the feature, or specify
-- @Active@ to activate it.
--
-- For more information, see
-- <https://docs.aws.amazon.com/compute-optimizer/latest/ug/inferred-workload-types.html Inferred workload types>
-- in the /Compute Optimizer User Guide/.
putRecommendationPreferences_inferredWorkloadTypes :: Lens.Lens' PutRecommendationPreferences (Prelude.Maybe InferredWorkloadTypesPreference)
putRecommendationPreferences_inferredWorkloadTypes :: Lens'
  PutRecommendationPreferences
  (Maybe InferredWorkloadTypesPreference)
putRecommendationPreferences_inferredWorkloadTypes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutRecommendationPreferences' {Maybe InferredWorkloadTypesPreference
inferredWorkloadTypes :: Maybe InferredWorkloadTypesPreference
$sel:inferredWorkloadTypes:PutRecommendationPreferences' :: PutRecommendationPreferences
-> Maybe InferredWorkloadTypesPreference
inferredWorkloadTypes} -> Maybe InferredWorkloadTypesPreference
inferredWorkloadTypes) (\s :: PutRecommendationPreferences
s@PutRecommendationPreferences' {} Maybe InferredWorkloadTypesPreference
a -> PutRecommendationPreferences
s {$sel:inferredWorkloadTypes:PutRecommendationPreferences' :: Maybe InferredWorkloadTypesPreference
inferredWorkloadTypes = Maybe InferredWorkloadTypesPreference
a} :: PutRecommendationPreferences)

-- | An object that describes the scope of the recommendation preference to
-- create.
--
-- You can create recommendation preferences at the organization level (for
-- management accounts of an organization only), account level, and
-- resource level. For more information, see
-- <https://docs.aws.amazon.com/compute-optimizer/latest/ug/enhanced-infrastructure-metrics.html Activating enhanced infrastructure metrics>
-- in the /Compute Optimizer User Guide/.
--
-- You cannot create recommendation preferences for Auto Scaling groups at
-- the organization and account levels. You can create recommendation
-- preferences for Auto Scaling groups only at the resource level by
-- specifying a scope name of @ResourceArn@ and a scope value of the Auto
-- Scaling group Amazon Resource Name (ARN). This will configure the
-- preference for all instances that are part of the specified Auto Scaling
-- group. You also cannot create recommendation preferences at the resource
-- level for instances that are part of an Auto Scaling group. You can
-- create recommendation preferences at the resource level only for
-- standalone instances.
putRecommendationPreferences_scope :: Lens.Lens' PutRecommendationPreferences (Prelude.Maybe Scope)
putRecommendationPreferences_scope :: Lens' PutRecommendationPreferences (Maybe Scope)
putRecommendationPreferences_scope = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutRecommendationPreferences' {Maybe Scope
scope :: Maybe Scope
$sel:scope:PutRecommendationPreferences' :: PutRecommendationPreferences -> Maybe Scope
scope} -> Maybe Scope
scope) (\s :: PutRecommendationPreferences
s@PutRecommendationPreferences' {} Maybe Scope
a -> PutRecommendationPreferences
s {$sel:scope:PutRecommendationPreferences' :: Maybe Scope
scope = Maybe Scope
a} :: PutRecommendationPreferences)

-- | The target resource type of the recommendation preference to create.
--
-- The @Ec2Instance@ option encompasses standalone instances and instances
-- that are part of Auto Scaling groups. The @AutoScalingGroup@ option
-- encompasses only instances that are part of an Auto Scaling group.
--
-- The valid values for this parameter are @Ec2Instance@ and
-- @AutoScalingGroup@.
putRecommendationPreferences_resourceType :: Lens.Lens' PutRecommendationPreferences ResourceType
putRecommendationPreferences_resourceType :: Lens' PutRecommendationPreferences ResourceType
putRecommendationPreferences_resourceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutRecommendationPreferences' {ResourceType
resourceType :: ResourceType
$sel:resourceType:PutRecommendationPreferences' :: PutRecommendationPreferences -> ResourceType
resourceType} -> ResourceType
resourceType) (\s :: PutRecommendationPreferences
s@PutRecommendationPreferences' {} ResourceType
a -> PutRecommendationPreferences
s {$sel:resourceType:PutRecommendationPreferences' :: ResourceType
resourceType = ResourceType
a} :: PutRecommendationPreferences)

instance Core.AWSRequest PutRecommendationPreferences where
  type
    AWSResponse PutRecommendationPreferences =
      PutRecommendationPreferencesResponse
  request :: (Service -> Service)
-> PutRecommendationPreferences
-> Request PutRecommendationPreferences
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy PutRecommendationPreferences
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse PutRecommendationPreferences)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> PutRecommendationPreferencesResponse
PutRecommendationPreferencesResponse'
            forall (f :: * -> *) a b. Functor 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
    PutRecommendationPreferences
  where
  hashWithSalt :: Int -> PutRecommendationPreferences -> Int
hashWithSalt Int
_salt PutRecommendationPreferences' {Maybe EnhancedInfrastructureMetrics
Maybe ExternalMetricsPreference
Maybe InferredWorkloadTypesPreference
Maybe Scope
ResourceType
resourceType :: ResourceType
scope :: Maybe Scope
inferredWorkloadTypes :: Maybe InferredWorkloadTypesPreference
externalMetricsPreference :: Maybe ExternalMetricsPreference
enhancedInfrastructureMetrics :: Maybe EnhancedInfrastructureMetrics
$sel:resourceType:PutRecommendationPreferences' :: PutRecommendationPreferences -> ResourceType
$sel:scope:PutRecommendationPreferences' :: PutRecommendationPreferences -> Maybe Scope
$sel:inferredWorkloadTypes:PutRecommendationPreferences' :: PutRecommendationPreferences
-> Maybe InferredWorkloadTypesPreference
$sel:externalMetricsPreference:PutRecommendationPreferences' :: PutRecommendationPreferences -> Maybe ExternalMetricsPreference
$sel:enhancedInfrastructureMetrics:PutRecommendationPreferences' :: PutRecommendationPreferences -> Maybe EnhancedInfrastructureMetrics
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe EnhancedInfrastructureMetrics
enhancedInfrastructureMetrics
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ExternalMetricsPreference
externalMetricsPreference
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe InferredWorkloadTypesPreference
inferredWorkloadTypes
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Scope
scope
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ResourceType
resourceType

instance Prelude.NFData PutRecommendationPreferences where
  rnf :: PutRecommendationPreferences -> ()
rnf PutRecommendationPreferences' {Maybe EnhancedInfrastructureMetrics
Maybe ExternalMetricsPreference
Maybe InferredWorkloadTypesPreference
Maybe Scope
ResourceType
resourceType :: ResourceType
scope :: Maybe Scope
inferredWorkloadTypes :: Maybe InferredWorkloadTypesPreference
externalMetricsPreference :: Maybe ExternalMetricsPreference
enhancedInfrastructureMetrics :: Maybe EnhancedInfrastructureMetrics
$sel:resourceType:PutRecommendationPreferences' :: PutRecommendationPreferences -> ResourceType
$sel:scope:PutRecommendationPreferences' :: PutRecommendationPreferences -> Maybe Scope
$sel:inferredWorkloadTypes:PutRecommendationPreferences' :: PutRecommendationPreferences
-> Maybe InferredWorkloadTypesPreference
$sel:externalMetricsPreference:PutRecommendationPreferences' :: PutRecommendationPreferences -> Maybe ExternalMetricsPreference
$sel:enhancedInfrastructureMetrics:PutRecommendationPreferences' :: PutRecommendationPreferences -> Maybe EnhancedInfrastructureMetrics
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe EnhancedInfrastructureMetrics
enhancedInfrastructureMetrics
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ExternalMetricsPreference
externalMetricsPreference
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe InferredWorkloadTypesPreference
inferredWorkloadTypes
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Scope
scope
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ResourceType
resourceType

instance Data.ToHeaders PutRecommendationPreferences where
  toHeaders :: PutRecommendationPreferences -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"ComputeOptimizerService.PutRecommendationPreferences" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.0" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON PutRecommendationPreferences where
  toJSON :: PutRecommendationPreferences -> Value
toJSON PutRecommendationPreferences' {Maybe EnhancedInfrastructureMetrics
Maybe ExternalMetricsPreference
Maybe InferredWorkloadTypesPreference
Maybe Scope
ResourceType
resourceType :: ResourceType
scope :: Maybe Scope
inferredWorkloadTypes :: Maybe InferredWorkloadTypesPreference
externalMetricsPreference :: Maybe ExternalMetricsPreference
enhancedInfrastructureMetrics :: Maybe EnhancedInfrastructureMetrics
$sel:resourceType:PutRecommendationPreferences' :: PutRecommendationPreferences -> ResourceType
$sel:scope:PutRecommendationPreferences' :: PutRecommendationPreferences -> Maybe Scope
$sel:inferredWorkloadTypes:PutRecommendationPreferences' :: PutRecommendationPreferences
-> Maybe InferredWorkloadTypesPreference
$sel:externalMetricsPreference:PutRecommendationPreferences' :: PutRecommendationPreferences -> Maybe ExternalMetricsPreference
$sel:enhancedInfrastructureMetrics:PutRecommendationPreferences' :: PutRecommendationPreferences -> Maybe EnhancedInfrastructureMetrics
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"enhancedInfrastructureMetrics" 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 EnhancedInfrastructureMetrics
enhancedInfrastructureMetrics,
            (Key
"externalMetricsPreference" 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 ExternalMetricsPreference
externalMetricsPreference,
            (Key
"inferredWorkloadTypes" 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 InferredWorkloadTypesPreference
inferredWorkloadTypes,
            (Key
"scope" 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 Scope
scope,
            forall a. a -> Maybe a
Prelude.Just (Key
"resourceType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= ResourceType
resourceType)
          ]
      )

instance Data.ToPath PutRecommendationPreferences where
  toPath :: PutRecommendationPreferences -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

-- | /See:/ 'newPutRecommendationPreferencesResponse' smart constructor.
data PutRecommendationPreferencesResponse = PutRecommendationPreferencesResponse'
  { -- | The response's http status code.
    PutRecommendationPreferencesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (PutRecommendationPreferencesResponse
-> PutRecommendationPreferencesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutRecommendationPreferencesResponse
-> PutRecommendationPreferencesResponse -> Bool
$c/= :: PutRecommendationPreferencesResponse
-> PutRecommendationPreferencesResponse -> Bool
== :: PutRecommendationPreferencesResponse
-> PutRecommendationPreferencesResponse -> Bool
$c== :: PutRecommendationPreferencesResponse
-> PutRecommendationPreferencesResponse -> Bool
Prelude.Eq, ReadPrec [PutRecommendationPreferencesResponse]
ReadPrec PutRecommendationPreferencesResponse
Int -> ReadS PutRecommendationPreferencesResponse
ReadS [PutRecommendationPreferencesResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutRecommendationPreferencesResponse]
$creadListPrec :: ReadPrec [PutRecommendationPreferencesResponse]
readPrec :: ReadPrec PutRecommendationPreferencesResponse
$creadPrec :: ReadPrec PutRecommendationPreferencesResponse
readList :: ReadS [PutRecommendationPreferencesResponse]
$creadList :: ReadS [PutRecommendationPreferencesResponse]
readsPrec :: Int -> ReadS PutRecommendationPreferencesResponse
$creadsPrec :: Int -> ReadS PutRecommendationPreferencesResponse
Prelude.Read, Int -> PutRecommendationPreferencesResponse -> ShowS
[PutRecommendationPreferencesResponse] -> ShowS
PutRecommendationPreferencesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutRecommendationPreferencesResponse] -> ShowS
$cshowList :: [PutRecommendationPreferencesResponse] -> ShowS
show :: PutRecommendationPreferencesResponse -> String
$cshow :: PutRecommendationPreferencesResponse -> String
showsPrec :: Int -> PutRecommendationPreferencesResponse -> ShowS
$cshowsPrec :: Int -> PutRecommendationPreferencesResponse -> ShowS
Prelude.Show, forall x.
Rep PutRecommendationPreferencesResponse x
-> PutRecommendationPreferencesResponse
forall x.
PutRecommendationPreferencesResponse
-> Rep PutRecommendationPreferencesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutRecommendationPreferencesResponse x
-> PutRecommendationPreferencesResponse
$cfrom :: forall x.
PutRecommendationPreferencesResponse
-> Rep PutRecommendationPreferencesResponse x
Prelude.Generic)

-- |
-- Create a value of 'PutRecommendationPreferencesResponse' 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:
--
-- 'httpStatus', 'putRecommendationPreferencesResponse_httpStatus' - The response's http status code.
newPutRecommendationPreferencesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  PutRecommendationPreferencesResponse
newPutRecommendationPreferencesResponse :: Int -> PutRecommendationPreferencesResponse
newPutRecommendationPreferencesResponse Int
pHttpStatus_ =
  PutRecommendationPreferencesResponse'
    { $sel:httpStatus:PutRecommendationPreferencesResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

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

instance
  Prelude.NFData
    PutRecommendationPreferencesResponse
  where
  rnf :: PutRecommendationPreferencesResponse -> ()
rnf PutRecommendationPreferencesResponse' {Int
httpStatus :: Int
$sel:httpStatus:PutRecommendationPreferencesResponse' :: PutRecommendationPreferencesResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus