{-# 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.CloudSearch.UpdateScalingParameters
-- 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)
--
-- Configures scaling parameters for a domain. A domain\'s scaling
-- parameters specify the desired search instance type and replication
-- count. Amazon CloudSearch will still automatically scale your domain
-- based on the volume of data and traffic, but not below the desired
-- instance type and replication count. If the Multi-AZ option is enabled,
-- these values control the resources used per Availability Zone. For more
-- information, see
-- <http://docs.aws.amazon.com/cloudsearch/latest/developerguide/configuring-scaling-options.html Configuring Scaling Options>
-- in the /Amazon CloudSearch Developer Guide/.
module Amazonka.CloudSearch.UpdateScalingParameters
  ( -- * Creating a Request
    UpdateScalingParameters (..),
    newUpdateScalingParameters,

    -- * Request Lenses
    updateScalingParameters_domainName,
    updateScalingParameters_scalingParameters,

    -- * Destructuring the Response
    UpdateScalingParametersResponse (..),
    newUpdateScalingParametersResponse,

    -- * Response Lenses
    updateScalingParametersResponse_httpStatus,
    updateScalingParametersResponse_scalingParameters,
  )
where

import Amazonka.CloudSearch.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | Container for the parameters to the @UpdateScalingParameters@ operation.
-- Specifies the name of the domain you want to update and the scaling
-- parameters you want to configure.
--
-- /See:/ 'newUpdateScalingParameters' smart constructor.
data UpdateScalingParameters = UpdateScalingParameters'
  { UpdateScalingParameters -> Text
domainName :: Prelude.Text,
    UpdateScalingParameters -> ScalingParameters
scalingParameters :: ScalingParameters
  }
  deriving (UpdateScalingParameters -> UpdateScalingParameters -> Bool
(UpdateScalingParameters -> UpdateScalingParameters -> Bool)
-> (UpdateScalingParameters -> UpdateScalingParameters -> Bool)
-> Eq UpdateScalingParameters
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateScalingParameters -> UpdateScalingParameters -> Bool
$c/= :: UpdateScalingParameters -> UpdateScalingParameters -> Bool
== :: UpdateScalingParameters -> UpdateScalingParameters -> Bool
$c== :: UpdateScalingParameters -> UpdateScalingParameters -> Bool
Prelude.Eq, ReadPrec [UpdateScalingParameters]
ReadPrec UpdateScalingParameters
Int -> ReadS UpdateScalingParameters
ReadS [UpdateScalingParameters]
(Int -> ReadS UpdateScalingParameters)
-> ReadS [UpdateScalingParameters]
-> ReadPrec UpdateScalingParameters
-> ReadPrec [UpdateScalingParameters]
-> Read UpdateScalingParameters
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateScalingParameters]
$creadListPrec :: ReadPrec [UpdateScalingParameters]
readPrec :: ReadPrec UpdateScalingParameters
$creadPrec :: ReadPrec UpdateScalingParameters
readList :: ReadS [UpdateScalingParameters]
$creadList :: ReadS [UpdateScalingParameters]
readsPrec :: Int -> ReadS UpdateScalingParameters
$creadsPrec :: Int -> ReadS UpdateScalingParameters
Prelude.Read, Int -> UpdateScalingParameters -> ShowS
[UpdateScalingParameters] -> ShowS
UpdateScalingParameters -> String
(Int -> UpdateScalingParameters -> ShowS)
-> (UpdateScalingParameters -> String)
-> ([UpdateScalingParameters] -> ShowS)
-> Show UpdateScalingParameters
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateScalingParameters] -> ShowS
$cshowList :: [UpdateScalingParameters] -> ShowS
show :: UpdateScalingParameters -> String
$cshow :: UpdateScalingParameters -> String
showsPrec :: Int -> UpdateScalingParameters -> ShowS
$cshowsPrec :: Int -> UpdateScalingParameters -> ShowS
Prelude.Show, (forall x.
 UpdateScalingParameters -> Rep UpdateScalingParameters x)
-> (forall x.
    Rep UpdateScalingParameters x -> UpdateScalingParameters)
-> Generic UpdateScalingParameters
forall x. Rep UpdateScalingParameters x -> UpdateScalingParameters
forall x. UpdateScalingParameters -> Rep UpdateScalingParameters x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateScalingParameters x -> UpdateScalingParameters
$cfrom :: forall x. UpdateScalingParameters -> Rep UpdateScalingParameters x
Prelude.Generic)

-- |
-- Create a value of 'UpdateScalingParameters' 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:
--
-- 'domainName', 'updateScalingParameters_domainName' - Undocumented member.
--
-- 'scalingParameters', 'updateScalingParameters_scalingParameters' - Undocumented member.
newUpdateScalingParameters ::
  -- | 'domainName'
  Prelude.Text ->
  -- | 'scalingParameters'
  ScalingParameters ->
  UpdateScalingParameters
newUpdateScalingParameters :: Text -> ScalingParameters -> UpdateScalingParameters
newUpdateScalingParameters
  Text
pDomainName_
  ScalingParameters
pScalingParameters_ =
    UpdateScalingParameters' :: Text -> ScalingParameters -> UpdateScalingParameters
UpdateScalingParameters'
      { $sel:domainName:UpdateScalingParameters' :: Text
domainName = Text
pDomainName_,
        $sel:scalingParameters:UpdateScalingParameters' :: ScalingParameters
scalingParameters = ScalingParameters
pScalingParameters_
      }

-- | Undocumented member.
updateScalingParameters_domainName :: Lens.Lens' UpdateScalingParameters Prelude.Text
updateScalingParameters_domainName :: (Text -> f Text)
-> UpdateScalingParameters -> f UpdateScalingParameters
updateScalingParameters_domainName = (UpdateScalingParameters -> Text)
-> (UpdateScalingParameters -> Text -> UpdateScalingParameters)
-> Lens UpdateScalingParameters UpdateScalingParameters Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateScalingParameters' {Text
domainName :: Text
$sel:domainName:UpdateScalingParameters' :: UpdateScalingParameters -> Text
domainName} -> Text
domainName) (\s :: UpdateScalingParameters
s@UpdateScalingParameters' {} Text
a -> UpdateScalingParameters
s {$sel:domainName:UpdateScalingParameters' :: Text
domainName = Text
a} :: UpdateScalingParameters)

-- | Undocumented member.
updateScalingParameters_scalingParameters :: Lens.Lens' UpdateScalingParameters ScalingParameters
updateScalingParameters_scalingParameters :: (ScalingParameters -> f ScalingParameters)
-> UpdateScalingParameters -> f UpdateScalingParameters
updateScalingParameters_scalingParameters = (UpdateScalingParameters -> ScalingParameters)
-> (UpdateScalingParameters
    -> ScalingParameters -> UpdateScalingParameters)
-> Lens
     UpdateScalingParameters
     UpdateScalingParameters
     ScalingParameters
     ScalingParameters
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateScalingParameters' {ScalingParameters
scalingParameters :: ScalingParameters
$sel:scalingParameters:UpdateScalingParameters' :: UpdateScalingParameters -> ScalingParameters
scalingParameters} -> ScalingParameters
scalingParameters) (\s :: UpdateScalingParameters
s@UpdateScalingParameters' {} ScalingParameters
a -> UpdateScalingParameters
s {$sel:scalingParameters:UpdateScalingParameters' :: ScalingParameters
scalingParameters = ScalingParameters
a} :: UpdateScalingParameters)

instance Core.AWSRequest UpdateScalingParameters where
  type
    AWSResponse UpdateScalingParameters =
      UpdateScalingParametersResponse
  request :: UpdateScalingParameters -> Request UpdateScalingParameters
request = Service
-> UpdateScalingParameters -> Request UpdateScalingParameters
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy UpdateScalingParameters
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateScalingParameters)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse UpdateScalingParameters))
-> Logger
-> Service
-> Proxy UpdateScalingParameters
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateScalingParameters)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"UpdateScalingParametersResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Int -> ScalingParametersStatus -> UpdateScalingParametersResponse
UpdateScalingParametersResponse'
            (Int -> ScalingParametersStatus -> UpdateScalingParametersResponse)
-> Either String Int
-> Either
     String (ScalingParametersStatus -> UpdateScalingParametersResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
            Either
  String (ScalingParametersStatus -> UpdateScalingParametersResponse)
-> Either String ScalingParametersStatus
-> Either String UpdateScalingParametersResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String ScalingParametersStatus
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"ScalingParameters")
      )

instance Prelude.Hashable UpdateScalingParameters

instance Prelude.NFData UpdateScalingParameters

instance Core.ToHeaders UpdateScalingParameters where
  toHeaders :: UpdateScalingParameters -> ResponseHeaders
toHeaders = ResponseHeaders -> UpdateScalingParameters -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

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

instance Core.ToQuery UpdateScalingParameters where
  toQuery :: UpdateScalingParameters -> QueryString
toQuery UpdateScalingParameters' {Text
ScalingParameters
scalingParameters :: ScalingParameters
domainName :: Text
$sel:scalingParameters:UpdateScalingParameters' :: UpdateScalingParameters -> ScalingParameters
$sel:domainName:UpdateScalingParameters' :: UpdateScalingParameters -> Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"UpdateScalingParameters" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2013-01-01" :: Prelude.ByteString),
        ByteString
"DomainName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
domainName,
        ByteString
"ScalingParameters" ByteString -> ScalingParameters -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: ScalingParameters
scalingParameters
      ]

-- | The result of a @UpdateScalingParameters@ request. Contains the status
-- of the newly-configured scaling parameters.
--
-- /See:/ 'newUpdateScalingParametersResponse' smart constructor.
data UpdateScalingParametersResponse = UpdateScalingParametersResponse'
  { -- | The response's http status code.
    UpdateScalingParametersResponse -> Int
httpStatus :: Prelude.Int,
    UpdateScalingParametersResponse -> ScalingParametersStatus
scalingParameters :: ScalingParametersStatus
  }
  deriving (UpdateScalingParametersResponse
-> UpdateScalingParametersResponse -> Bool
(UpdateScalingParametersResponse
 -> UpdateScalingParametersResponse -> Bool)
-> (UpdateScalingParametersResponse
    -> UpdateScalingParametersResponse -> Bool)
-> Eq UpdateScalingParametersResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateScalingParametersResponse
-> UpdateScalingParametersResponse -> Bool
$c/= :: UpdateScalingParametersResponse
-> UpdateScalingParametersResponse -> Bool
== :: UpdateScalingParametersResponse
-> UpdateScalingParametersResponse -> Bool
$c== :: UpdateScalingParametersResponse
-> UpdateScalingParametersResponse -> Bool
Prelude.Eq, ReadPrec [UpdateScalingParametersResponse]
ReadPrec UpdateScalingParametersResponse
Int -> ReadS UpdateScalingParametersResponse
ReadS [UpdateScalingParametersResponse]
(Int -> ReadS UpdateScalingParametersResponse)
-> ReadS [UpdateScalingParametersResponse]
-> ReadPrec UpdateScalingParametersResponse
-> ReadPrec [UpdateScalingParametersResponse]
-> Read UpdateScalingParametersResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateScalingParametersResponse]
$creadListPrec :: ReadPrec [UpdateScalingParametersResponse]
readPrec :: ReadPrec UpdateScalingParametersResponse
$creadPrec :: ReadPrec UpdateScalingParametersResponse
readList :: ReadS [UpdateScalingParametersResponse]
$creadList :: ReadS [UpdateScalingParametersResponse]
readsPrec :: Int -> ReadS UpdateScalingParametersResponse
$creadsPrec :: Int -> ReadS UpdateScalingParametersResponse
Prelude.Read, Int -> UpdateScalingParametersResponse -> ShowS
[UpdateScalingParametersResponse] -> ShowS
UpdateScalingParametersResponse -> String
(Int -> UpdateScalingParametersResponse -> ShowS)
-> (UpdateScalingParametersResponse -> String)
-> ([UpdateScalingParametersResponse] -> ShowS)
-> Show UpdateScalingParametersResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateScalingParametersResponse] -> ShowS
$cshowList :: [UpdateScalingParametersResponse] -> ShowS
show :: UpdateScalingParametersResponse -> String
$cshow :: UpdateScalingParametersResponse -> String
showsPrec :: Int -> UpdateScalingParametersResponse -> ShowS
$cshowsPrec :: Int -> UpdateScalingParametersResponse -> ShowS
Prelude.Show, (forall x.
 UpdateScalingParametersResponse
 -> Rep UpdateScalingParametersResponse x)
-> (forall x.
    Rep UpdateScalingParametersResponse x
    -> UpdateScalingParametersResponse)
-> Generic UpdateScalingParametersResponse
forall x.
Rep UpdateScalingParametersResponse x
-> UpdateScalingParametersResponse
forall x.
UpdateScalingParametersResponse
-> Rep UpdateScalingParametersResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateScalingParametersResponse x
-> UpdateScalingParametersResponse
$cfrom :: forall x.
UpdateScalingParametersResponse
-> Rep UpdateScalingParametersResponse x
Prelude.Generic)

-- |
-- Create a value of 'UpdateScalingParametersResponse' 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', 'updateScalingParametersResponse_httpStatus' - The response's http status code.
--
-- 'scalingParameters', 'updateScalingParametersResponse_scalingParameters' - Undocumented member.
newUpdateScalingParametersResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'scalingParameters'
  ScalingParametersStatus ->
  UpdateScalingParametersResponse
newUpdateScalingParametersResponse :: Int -> ScalingParametersStatus -> UpdateScalingParametersResponse
newUpdateScalingParametersResponse
  Int
pHttpStatus_
  ScalingParametersStatus
pScalingParameters_ =
    UpdateScalingParametersResponse' :: Int -> ScalingParametersStatus -> UpdateScalingParametersResponse
UpdateScalingParametersResponse'
      { $sel:httpStatus:UpdateScalingParametersResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:scalingParameters:UpdateScalingParametersResponse' :: ScalingParametersStatus
scalingParameters = ScalingParametersStatus
pScalingParameters_
      }

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

-- | Undocumented member.
updateScalingParametersResponse_scalingParameters :: Lens.Lens' UpdateScalingParametersResponse ScalingParametersStatus
updateScalingParametersResponse_scalingParameters :: (ScalingParametersStatus -> f ScalingParametersStatus)
-> UpdateScalingParametersResponse
-> f UpdateScalingParametersResponse
updateScalingParametersResponse_scalingParameters = (UpdateScalingParametersResponse -> ScalingParametersStatus)
-> (UpdateScalingParametersResponse
    -> ScalingParametersStatus -> UpdateScalingParametersResponse)
-> Lens
     UpdateScalingParametersResponse
     UpdateScalingParametersResponse
     ScalingParametersStatus
     ScalingParametersStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateScalingParametersResponse' {ScalingParametersStatus
scalingParameters :: ScalingParametersStatus
$sel:scalingParameters:UpdateScalingParametersResponse' :: UpdateScalingParametersResponse -> ScalingParametersStatus
scalingParameters} -> ScalingParametersStatus
scalingParameters) (\s :: UpdateScalingParametersResponse
s@UpdateScalingParametersResponse' {} ScalingParametersStatus
a -> UpdateScalingParametersResponse
s {$sel:scalingParameters:UpdateScalingParametersResponse' :: ScalingParametersStatus
scalingParameters = ScalingParametersStatus
a} :: UpdateScalingParametersResponse)

instance
  Prelude.NFData
    UpdateScalingParametersResponse