{-# 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.RedshiftServerLess.UpdateWorkgroup
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Updates a workgroup with the specified configuration settings.
module Amazonka.RedshiftServerLess.UpdateWorkgroup
  ( -- * Creating a Request
    UpdateWorkgroup (..),
    newUpdateWorkgroup,

    -- * Request Lenses
    updateWorkgroup_baseCapacity,
    updateWorkgroup_configParameters,
    updateWorkgroup_enhancedVpcRouting,
    updateWorkgroup_port,
    updateWorkgroup_publiclyAccessible,
    updateWorkgroup_securityGroupIds,
    updateWorkgroup_subnetIds,
    updateWorkgroup_workgroupName,

    -- * Destructuring the Response
    UpdateWorkgroupResponse (..),
    newUpdateWorkgroupResponse,

    -- * Response Lenses
    updateWorkgroupResponse_httpStatus,
    updateWorkgroupResponse_workgroup,
  )
where

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 Amazonka.RedshiftServerLess.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newUpdateWorkgroup' smart constructor.
data UpdateWorkgroup = UpdateWorkgroup'
  { -- | The new base data warehouse capacity in Redshift Processing Units
    -- (RPUs).
    UpdateWorkgroup -> Maybe Int
baseCapacity :: Prelude.Maybe Prelude.Int,
    -- | An array of parameters to set for advanced control over a database. The
    -- options are @datestyle@, @enable_user_activity_logging@, @query_group@,
    -- @search_path@, and @max_query_execution_time@.
    UpdateWorkgroup -> Maybe [ConfigParameter]
configParameters :: Prelude.Maybe [ConfigParameter],
    -- | The value that specifies whether to turn on enhanced virtual private
    -- cloud (VPC) routing, which forces Amazon Redshift Serverless to route
    -- traffic through your VPC.
    UpdateWorkgroup -> Maybe Bool
enhancedVpcRouting :: Prelude.Maybe Prelude.Bool,
    -- | The custom port to use when connecting to a workgroup. Valid port ranges
    -- are 5431-5455 and 8191-8215. The default is 5439.
    UpdateWorkgroup -> Maybe Int
port :: Prelude.Maybe Prelude.Int,
    -- | A value that specifies whether the workgroup can be accessible from a
    -- public network.
    UpdateWorkgroup -> Maybe Bool
publiclyAccessible :: Prelude.Maybe Prelude.Bool,
    -- | An array of security group IDs to associate with the workgroup.
    UpdateWorkgroup -> Maybe [Text]
securityGroupIds :: Prelude.Maybe [Prelude.Text],
    -- | An array of VPC subnet IDs to associate with the workgroup.
    UpdateWorkgroup -> Maybe [Text]
subnetIds :: Prelude.Maybe [Prelude.Text],
    -- | The name of the workgroup to update.
    UpdateWorkgroup -> Text
workgroupName :: Prelude.Text
  }
  deriving (UpdateWorkgroup -> UpdateWorkgroup -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateWorkgroup -> UpdateWorkgroup -> Bool
$c/= :: UpdateWorkgroup -> UpdateWorkgroup -> Bool
== :: UpdateWorkgroup -> UpdateWorkgroup -> Bool
$c== :: UpdateWorkgroup -> UpdateWorkgroup -> Bool
Prelude.Eq, ReadPrec [UpdateWorkgroup]
ReadPrec UpdateWorkgroup
Int -> ReadS UpdateWorkgroup
ReadS [UpdateWorkgroup]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateWorkgroup]
$creadListPrec :: ReadPrec [UpdateWorkgroup]
readPrec :: ReadPrec UpdateWorkgroup
$creadPrec :: ReadPrec UpdateWorkgroup
readList :: ReadS [UpdateWorkgroup]
$creadList :: ReadS [UpdateWorkgroup]
readsPrec :: Int -> ReadS UpdateWorkgroup
$creadsPrec :: Int -> ReadS UpdateWorkgroup
Prelude.Read, Int -> UpdateWorkgroup -> ShowS
[UpdateWorkgroup] -> ShowS
UpdateWorkgroup -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateWorkgroup] -> ShowS
$cshowList :: [UpdateWorkgroup] -> ShowS
show :: UpdateWorkgroup -> String
$cshow :: UpdateWorkgroup -> String
showsPrec :: Int -> UpdateWorkgroup -> ShowS
$cshowsPrec :: Int -> UpdateWorkgroup -> ShowS
Prelude.Show, forall x. Rep UpdateWorkgroup x -> UpdateWorkgroup
forall x. UpdateWorkgroup -> Rep UpdateWorkgroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateWorkgroup x -> UpdateWorkgroup
$cfrom :: forall x. UpdateWorkgroup -> Rep UpdateWorkgroup x
Prelude.Generic)

-- |
-- Create a value of 'UpdateWorkgroup' 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:
--
-- 'baseCapacity', 'updateWorkgroup_baseCapacity' - The new base data warehouse capacity in Redshift Processing Units
-- (RPUs).
--
-- 'configParameters', 'updateWorkgroup_configParameters' - An array of parameters to set for advanced control over a database. The
-- options are @datestyle@, @enable_user_activity_logging@, @query_group@,
-- @search_path@, and @max_query_execution_time@.
--
-- 'enhancedVpcRouting', 'updateWorkgroup_enhancedVpcRouting' - The value that specifies whether to turn on enhanced virtual private
-- cloud (VPC) routing, which forces Amazon Redshift Serverless to route
-- traffic through your VPC.
--
-- 'port', 'updateWorkgroup_port' - The custom port to use when connecting to a workgroup. Valid port ranges
-- are 5431-5455 and 8191-8215. The default is 5439.
--
-- 'publiclyAccessible', 'updateWorkgroup_publiclyAccessible' - A value that specifies whether the workgroup can be accessible from a
-- public network.
--
-- 'securityGroupIds', 'updateWorkgroup_securityGroupIds' - An array of security group IDs to associate with the workgroup.
--
-- 'subnetIds', 'updateWorkgroup_subnetIds' - An array of VPC subnet IDs to associate with the workgroup.
--
-- 'workgroupName', 'updateWorkgroup_workgroupName' - The name of the workgroup to update.
newUpdateWorkgroup ::
  -- | 'workgroupName'
  Prelude.Text ->
  UpdateWorkgroup
newUpdateWorkgroup :: Text -> UpdateWorkgroup
newUpdateWorkgroup Text
pWorkgroupName_ =
  UpdateWorkgroup'
    { $sel:baseCapacity:UpdateWorkgroup' :: Maybe Int
baseCapacity = forall a. Maybe a
Prelude.Nothing,
      $sel:configParameters:UpdateWorkgroup' :: Maybe [ConfigParameter]
configParameters = forall a. Maybe a
Prelude.Nothing,
      $sel:enhancedVpcRouting:UpdateWorkgroup' :: Maybe Bool
enhancedVpcRouting = forall a. Maybe a
Prelude.Nothing,
      $sel:port:UpdateWorkgroup' :: Maybe Int
port = forall a. Maybe a
Prelude.Nothing,
      $sel:publiclyAccessible:UpdateWorkgroup' :: Maybe Bool
publiclyAccessible = forall a. Maybe a
Prelude.Nothing,
      $sel:securityGroupIds:UpdateWorkgroup' :: Maybe [Text]
securityGroupIds = forall a. Maybe a
Prelude.Nothing,
      $sel:subnetIds:UpdateWorkgroup' :: Maybe [Text]
subnetIds = forall a. Maybe a
Prelude.Nothing,
      $sel:workgroupName:UpdateWorkgroup' :: Text
workgroupName = Text
pWorkgroupName_
    }

-- | The new base data warehouse capacity in Redshift Processing Units
-- (RPUs).
updateWorkgroup_baseCapacity :: Lens.Lens' UpdateWorkgroup (Prelude.Maybe Prelude.Int)
updateWorkgroup_baseCapacity :: Lens' UpdateWorkgroup (Maybe Int)
updateWorkgroup_baseCapacity = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateWorkgroup' {Maybe Int
baseCapacity :: Maybe Int
$sel:baseCapacity:UpdateWorkgroup' :: UpdateWorkgroup -> Maybe Int
baseCapacity} -> Maybe Int
baseCapacity) (\s :: UpdateWorkgroup
s@UpdateWorkgroup' {} Maybe Int
a -> UpdateWorkgroup
s {$sel:baseCapacity:UpdateWorkgroup' :: Maybe Int
baseCapacity = Maybe Int
a} :: UpdateWorkgroup)

-- | An array of parameters to set for advanced control over a database. The
-- options are @datestyle@, @enable_user_activity_logging@, @query_group@,
-- @search_path@, and @max_query_execution_time@.
updateWorkgroup_configParameters :: Lens.Lens' UpdateWorkgroup (Prelude.Maybe [ConfigParameter])
updateWorkgroup_configParameters :: Lens' UpdateWorkgroup (Maybe [ConfigParameter])
updateWorkgroup_configParameters = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateWorkgroup' {Maybe [ConfigParameter]
configParameters :: Maybe [ConfigParameter]
$sel:configParameters:UpdateWorkgroup' :: UpdateWorkgroup -> Maybe [ConfigParameter]
configParameters} -> Maybe [ConfigParameter]
configParameters) (\s :: UpdateWorkgroup
s@UpdateWorkgroup' {} Maybe [ConfigParameter]
a -> UpdateWorkgroup
s {$sel:configParameters:UpdateWorkgroup' :: Maybe [ConfigParameter]
configParameters = Maybe [ConfigParameter]
a} :: UpdateWorkgroup) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The value that specifies whether to turn on enhanced virtual private
-- cloud (VPC) routing, which forces Amazon Redshift Serverless to route
-- traffic through your VPC.
updateWorkgroup_enhancedVpcRouting :: Lens.Lens' UpdateWorkgroup (Prelude.Maybe Prelude.Bool)
updateWorkgroup_enhancedVpcRouting :: Lens' UpdateWorkgroup (Maybe Bool)
updateWorkgroup_enhancedVpcRouting = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateWorkgroup' {Maybe Bool
enhancedVpcRouting :: Maybe Bool
$sel:enhancedVpcRouting:UpdateWorkgroup' :: UpdateWorkgroup -> Maybe Bool
enhancedVpcRouting} -> Maybe Bool
enhancedVpcRouting) (\s :: UpdateWorkgroup
s@UpdateWorkgroup' {} Maybe Bool
a -> UpdateWorkgroup
s {$sel:enhancedVpcRouting:UpdateWorkgroup' :: Maybe Bool
enhancedVpcRouting = Maybe Bool
a} :: UpdateWorkgroup)

-- | The custom port to use when connecting to a workgroup. Valid port ranges
-- are 5431-5455 and 8191-8215. The default is 5439.
updateWorkgroup_port :: Lens.Lens' UpdateWorkgroup (Prelude.Maybe Prelude.Int)
updateWorkgroup_port :: Lens' UpdateWorkgroup (Maybe Int)
updateWorkgroup_port = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateWorkgroup' {Maybe Int
port :: Maybe Int
$sel:port:UpdateWorkgroup' :: UpdateWorkgroup -> Maybe Int
port} -> Maybe Int
port) (\s :: UpdateWorkgroup
s@UpdateWorkgroup' {} Maybe Int
a -> UpdateWorkgroup
s {$sel:port:UpdateWorkgroup' :: Maybe Int
port = Maybe Int
a} :: UpdateWorkgroup)

-- | A value that specifies whether the workgroup can be accessible from a
-- public network.
updateWorkgroup_publiclyAccessible :: Lens.Lens' UpdateWorkgroup (Prelude.Maybe Prelude.Bool)
updateWorkgroup_publiclyAccessible :: Lens' UpdateWorkgroup (Maybe Bool)
updateWorkgroup_publiclyAccessible = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateWorkgroup' {Maybe Bool
publiclyAccessible :: Maybe Bool
$sel:publiclyAccessible:UpdateWorkgroup' :: UpdateWorkgroup -> Maybe Bool
publiclyAccessible} -> Maybe Bool
publiclyAccessible) (\s :: UpdateWorkgroup
s@UpdateWorkgroup' {} Maybe Bool
a -> UpdateWorkgroup
s {$sel:publiclyAccessible:UpdateWorkgroup' :: Maybe Bool
publiclyAccessible = Maybe Bool
a} :: UpdateWorkgroup)

-- | An array of security group IDs to associate with the workgroup.
updateWorkgroup_securityGroupIds :: Lens.Lens' UpdateWorkgroup (Prelude.Maybe [Prelude.Text])
updateWorkgroup_securityGroupIds :: Lens' UpdateWorkgroup (Maybe [Text])
updateWorkgroup_securityGroupIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateWorkgroup' {Maybe [Text]
securityGroupIds :: Maybe [Text]
$sel:securityGroupIds:UpdateWorkgroup' :: UpdateWorkgroup -> Maybe [Text]
securityGroupIds} -> Maybe [Text]
securityGroupIds) (\s :: UpdateWorkgroup
s@UpdateWorkgroup' {} Maybe [Text]
a -> UpdateWorkgroup
s {$sel:securityGroupIds:UpdateWorkgroup' :: Maybe [Text]
securityGroupIds = Maybe [Text]
a} :: UpdateWorkgroup) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | An array of VPC subnet IDs to associate with the workgroup.
updateWorkgroup_subnetIds :: Lens.Lens' UpdateWorkgroup (Prelude.Maybe [Prelude.Text])
updateWorkgroup_subnetIds :: Lens' UpdateWorkgroup (Maybe [Text])
updateWorkgroup_subnetIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateWorkgroup' {Maybe [Text]
subnetIds :: Maybe [Text]
$sel:subnetIds:UpdateWorkgroup' :: UpdateWorkgroup -> Maybe [Text]
subnetIds} -> Maybe [Text]
subnetIds) (\s :: UpdateWorkgroup
s@UpdateWorkgroup' {} Maybe [Text]
a -> UpdateWorkgroup
s {$sel:subnetIds:UpdateWorkgroup' :: Maybe [Text]
subnetIds = Maybe [Text]
a} :: UpdateWorkgroup) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name of the workgroup to update.
updateWorkgroup_workgroupName :: Lens.Lens' UpdateWorkgroup Prelude.Text
updateWorkgroup_workgroupName :: Lens' UpdateWorkgroup Text
updateWorkgroup_workgroupName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateWorkgroup' {Text
workgroupName :: Text
$sel:workgroupName:UpdateWorkgroup' :: UpdateWorkgroup -> Text
workgroupName} -> Text
workgroupName) (\s :: UpdateWorkgroup
s@UpdateWorkgroup' {} Text
a -> UpdateWorkgroup
s {$sel:workgroupName:UpdateWorkgroup' :: Text
workgroupName = Text
a} :: UpdateWorkgroup)

instance Core.AWSRequest UpdateWorkgroup where
  type
    AWSResponse UpdateWorkgroup =
      UpdateWorkgroupResponse
  request :: (Service -> Service) -> UpdateWorkgroup -> Request UpdateWorkgroup
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 UpdateWorkgroup
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateWorkgroup)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Int -> Workgroup -> UpdateWorkgroupResponse
UpdateWorkgroupResponse'
            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))
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"workgroup")
      )

instance Prelude.Hashable UpdateWorkgroup where
  hashWithSalt :: Int -> UpdateWorkgroup -> Int
hashWithSalt Int
_salt UpdateWorkgroup' {Maybe Bool
Maybe Int
Maybe [Text]
Maybe [ConfigParameter]
Text
workgroupName :: Text
subnetIds :: Maybe [Text]
securityGroupIds :: Maybe [Text]
publiclyAccessible :: Maybe Bool
port :: Maybe Int
enhancedVpcRouting :: Maybe Bool
configParameters :: Maybe [ConfigParameter]
baseCapacity :: Maybe Int
$sel:workgroupName:UpdateWorkgroup' :: UpdateWorkgroup -> Text
$sel:subnetIds:UpdateWorkgroup' :: UpdateWorkgroup -> Maybe [Text]
$sel:securityGroupIds:UpdateWorkgroup' :: UpdateWorkgroup -> Maybe [Text]
$sel:publiclyAccessible:UpdateWorkgroup' :: UpdateWorkgroup -> Maybe Bool
$sel:port:UpdateWorkgroup' :: UpdateWorkgroup -> Maybe Int
$sel:enhancedVpcRouting:UpdateWorkgroup' :: UpdateWorkgroup -> Maybe Bool
$sel:configParameters:UpdateWorkgroup' :: UpdateWorkgroup -> Maybe [ConfigParameter]
$sel:baseCapacity:UpdateWorkgroup' :: UpdateWorkgroup -> Maybe Int
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
baseCapacity
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [ConfigParameter]
configParameters
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
enhancedVpcRouting
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
port
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
publiclyAccessible
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
securityGroupIds
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
subnetIds
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
workgroupName

instance Prelude.NFData UpdateWorkgroup where
  rnf :: UpdateWorkgroup -> ()
rnf UpdateWorkgroup' {Maybe Bool
Maybe Int
Maybe [Text]
Maybe [ConfigParameter]
Text
workgroupName :: Text
subnetIds :: Maybe [Text]
securityGroupIds :: Maybe [Text]
publiclyAccessible :: Maybe Bool
port :: Maybe Int
enhancedVpcRouting :: Maybe Bool
configParameters :: Maybe [ConfigParameter]
baseCapacity :: Maybe Int
$sel:workgroupName:UpdateWorkgroup' :: UpdateWorkgroup -> Text
$sel:subnetIds:UpdateWorkgroup' :: UpdateWorkgroup -> Maybe [Text]
$sel:securityGroupIds:UpdateWorkgroup' :: UpdateWorkgroup -> Maybe [Text]
$sel:publiclyAccessible:UpdateWorkgroup' :: UpdateWorkgroup -> Maybe Bool
$sel:port:UpdateWorkgroup' :: UpdateWorkgroup -> Maybe Int
$sel:enhancedVpcRouting:UpdateWorkgroup' :: UpdateWorkgroup -> Maybe Bool
$sel:configParameters:UpdateWorkgroup' :: UpdateWorkgroup -> Maybe [ConfigParameter]
$sel:baseCapacity:UpdateWorkgroup' :: UpdateWorkgroup -> Maybe Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
baseCapacity
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [ConfigParameter]
configParameters
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
enhancedVpcRouting
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
port
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
publiclyAccessible
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
securityGroupIds
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
subnetIds
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
workgroupName

instance Data.ToHeaders UpdateWorkgroup where
  toHeaders :: UpdateWorkgroup -> 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
"RedshiftServerless.UpdateWorkgroup" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON UpdateWorkgroup where
  toJSON :: UpdateWorkgroup -> Value
toJSON UpdateWorkgroup' {Maybe Bool
Maybe Int
Maybe [Text]
Maybe [ConfigParameter]
Text
workgroupName :: Text
subnetIds :: Maybe [Text]
securityGroupIds :: Maybe [Text]
publiclyAccessible :: Maybe Bool
port :: Maybe Int
enhancedVpcRouting :: Maybe Bool
configParameters :: Maybe [ConfigParameter]
baseCapacity :: Maybe Int
$sel:workgroupName:UpdateWorkgroup' :: UpdateWorkgroup -> Text
$sel:subnetIds:UpdateWorkgroup' :: UpdateWorkgroup -> Maybe [Text]
$sel:securityGroupIds:UpdateWorkgroup' :: UpdateWorkgroup -> Maybe [Text]
$sel:publiclyAccessible:UpdateWorkgroup' :: UpdateWorkgroup -> Maybe Bool
$sel:port:UpdateWorkgroup' :: UpdateWorkgroup -> Maybe Int
$sel:enhancedVpcRouting:UpdateWorkgroup' :: UpdateWorkgroup -> Maybe Bool
$sel:configParameters:UpdateWorkgroup' :: UpdateWorkgroup -> Maybe [ConfigParameter]
$sel:baseCapacity:UpdateWorkgroup' :: UpdateWorkgroup -> Maybe Int
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"baseCapacity" 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 Int
baseCapacity,
            (Key
"configParameters" 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 [ConfigParameter]
configParameters,
            (Key
"enhancedVpcRouting" 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 Bool
enhancedVpcRouting,
            (Key
"port" 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 Int
port,
            (Key
"publiclyAccessible" 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 Bool
publiclyAccessible,
            (Key
"securityGroupIds" 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 [Text]
securityGroupIds,
            (Key
"subnetIds" 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 [Text]
subnetIds,
            forall a. a -> Maybe a
Prelude.Just
              (Key
"workgroupName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
workgroupName)
          ]
      )

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

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

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

-- |
-- Create a value of 'UpdateWorkgroupResponse' 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', 'updateWorkgroupResponse_httpStatus' - The response's http status code.
--
-- 'workgroup', 'updateWorkgroupResponse_workgroup' - The updated workgroup object.
newUpdateWorkgroupResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'workgroup'
  Workgroup ->
  UpdateWorkgroupResponse
newUpdateWorkgroupResponse :: Int -> Workgroup -> UpdateWorkgroupResponse
newUpdateWorkgroupResponse Int
pHttpStatus_ Workgroup
pWorkgroup_ =
  UpdateWorkgroupResponse'
    { $sel:httpStatus:UpdateWorkgroupResponse' :: Int
httpStatus = Int
pHttpStatus_,
      $sel:workgroup:UpdateWorkgroupResponse' :: Workgroup
workgroup = Workgroup
pWorkgroup_
    }

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

-- | The updated workgroup object.
updateWorkgroupResponse_workgroup :: Lens.Lens' UpdateWorkgroupResponse Workgroup
updateWorkgroupResponse_workgroup :: Lens' UpdateWorkgroupResponse Workgroup
updateWorkgroupResponse_workgroup = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateWorkgroupResponse' {Workgroup
workgroup :: Workgroup
$sel:workgroup:UpdateWorkgroupResponse' :: UpdateWorkgroupResponse -> Workgroup
workgroup} -> Workgroup
workgroup) (\s :: UpdateWorkgroupResponse
s@UpdateWorkgroupResponse' {} Workgroup
a -> UpdateWorkgroupResponse
s {$sel:workgroup:UpdateWorkgroupResponse' :: Workgroup
workgroup = Workgroup
a} :: UpdateWorkgroupResponse)

instance Prelude.NFData UpdateWorkgroupResponse where
  rnf :: UpdateWorkgroupResponse -> ()
rnf UpdateWorkgroupResponse' {Int
Workgroup
workgroup :: Workgroup
httpStatus :: Int
$sel:workgroup:UpdateWorkgroupResponse' :: UpdateWorkgroupResponse -> Workgroup
$sel:httpStatus:UpdateWorkgroupResponse' :: UpdateWorkgroupResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Workgroup
workgroup