{-# 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.SecurityHub.UpdateStandardsControl
-- 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)
--
-- Used to control whether an individual security standard control is
-- enabled or disabled.
module Amazonka.SecurityHub.UpdateStandardsControl
  ( -- * Creating a Request
    UpdateStandardsControl (..),
    newUpdateStandardsControl,

    -- * Request Lenses
    updateStandardsControl_controlStatus,
    updateStandardsControl_disabledReason,
    updateStandardsControl_standardsControlArn,

    -- * Destructuring the Response
    UpdateStandardsControlResponse (..),
    newUpdateStandardsControlResponse,

    -- * Response Lenses
    updateStandardsControlResponse_httpStatus,
  )
where

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
import Amazonka.SecurityHub.Types

-- | /See:/ 'newUpdateStandardsControl' smart constructor.
data UpdateStandardsControl = UpdateStandardsControl'
  { -- | The updated status of the security standard control.
    UpdateStandardsControl -> Maybe ControlStatus
controlStatus :: Prelude.Maybe ControlStatus,
    -- | A description of the reason why you are disabling a security standard
    -- control. If you are disabling a control, then this is required.
    UpdateStandardsControl -> Maybe Text
disabledReason :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the security standard control to enable or disable.
    UpdateStandardsControl -> Text
standardsControlArn :: Prelude.Text
  }
  deriving (UpdateStandardsControl -> UpdateStandardsControl -> Bool
(UpdateStandardsControl -> UpdateStandardsControl -> Bool)
-> (UpdateStandardsControl -> UpdateStandardsControl -> Bool)
-> Eq UpdateStandardsControl
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateStandardsControl -> UpdateStandardsControl -> Bool
$c/= :: UpdateStandardsControl -> UpdateStandardsControl -> Bool
== :: UpdateStandardsControl -> UpdateStandardsControl -> Bool
$c== :: UpdateStandardsControl -> UpdateStandardsControl -> Bool
Prelude.Eq, ReadPrec [UpdateStandardsControl]
ReadPrec UpdateStandardsControl
Int -> ReadS UpdateStandardsControl
ReadS [UpdateStandardsControl]
(Int -> ReadS UpdateStandardsControl)
-> ReadS [UpdateStandardsControl]
-> ReadPrec UpdateStandardsControl
-> ReadPrec [UpdateStandardsControl]
-> Read UpdateStandardsControl
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateStandardsControl]
$creadListPrec :: ReadPrec [UpdateStandardsControl]
readPrec :: ReadPrec UpdateStandardsControl
$creadPrec :: ReadPrec UpdateStandardsControl
readList :: ReadS [UpdateStandardsControl]
$creadList :: ReadS [UpdateStandardsControl]
readsPrec :: Int -> ReadS UpdateStandardsControl
$creadsPrec :: Int -> ReadS UpdateStandardsControl
Prelude.Read, Int -> UpdateStandardsControl -> ShowS
[UpdateStandardsControl] -> ShowS
UpdateStandardsControl -> String
(Int -> UpdateStandardsControl -> ShowS)
-> (UpdateStandardsControl -> String)
-> ([UpdateStandardsControl] -> ShowS)
-> Show UpdateStandardsControl
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateStandardsControl] -> ShowS
$cshowList :: [UpdateStandardsControl] -> ShowS
show :: UpdateStandardsControl -> String
$cshow :: UpdateStandardsControl -> String
showsPrec :: Int -> UpdateStandardsControl -> ShowS
$cshowsPrec :: Int -> UpdateStandardsControl -> ShowS
Prelude.Show, (forall x. UpdateStandardsControl -> Rep UpdateStandardsControl x)
-> (forall x.
    Rep UpdateStandardsControl x -> UpdateStandardsControl)
-> Generic UpdateStandardsControl
forall x. Rep UpdateStandardsControl x -> UpdateStandardsControl
forall x. UpdateStandardsControl -> Rep UpdateStandardsControl x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateStandardsControl x -> UpdateStandardsControl
$cfrom :: forall x. UpdateStandardsControl -> Rep UpdateStandardsControl x
Prelude.Generic)

-- |
-- Create a value of 'UpdateStandardsControl' 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:
--
-- 'controlStatus', 'updateStandardsControl_controlStatus' - The updated status of the security standard control.
--
-- 'disabledReason', 'updateStandardsControl_disabledReason' - A description of the reason why you are disabling a security standard
-- control. If you are disabling a control, then this is required.
--
-- 'standardsControlArn', 'updateStandardsControl_standardsControlArn' - The ARN of the security standard control to enable or disable.
newUpdateStandardsControl ::
  -- | 'standardsControlArn'
  Prelude.Text ->
  UpdateStandardsControl
newUpdateStandardsControl :: Text -> UpdateStandardsControl
newUpdateStandardsControl Text
pStandardsControlArn_ =
  UpdateStandardsControl' :: Maybe ControlStatus -> Maybe Text -> Text -> UpdateStandardsControl
UpdateStandardsControl'
    { $sel:controlStatus:UpdateStandardsControl' :: Maybe ControlStatus
controlStatus =
        Maybe ControlStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:disabledReason:UpdateStandardsControl' :: Maybe Text
disabledReason = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:standardsControlArn:UpdateStandardsControl' :: Text
standardsControlArn = Text
pStandardsControlArn_
    }

-- | The updated status of the security standard control.
updateStandardsControl_controlStatus :: Lens.Lens' UpdateStandardsControl (Prelude.Maybe ControlStatus)
updateStandardsControl_controlStatus :: (Maybe ControlStatus -> f (Maybe ControlStatus))
-> UpdateStandardsControl -> f UpdateStandardsControl
updateStandardsControl_controlStatus = (UpdateStandardsControl -> Maybe ControlStatus)
-> (UpdateStandardsControl
    -> Maybe ControlStatus -> UpdateStandardsControl)
-> Lens
     UpdateStandardsControl
     UpdateStandardsControl
     (Maybe ControlStatus)
     (Maybe ControlStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateStandardsControl' {Maybe ControlStatus
controlStatus :: Maybe ControlStatus
$sel:controlStatus:UpdateStandardsControl' :: UpdateStandardsControl -> Maybe ControlStatus
controlStatus} -> Maybe ControlStatus
controlStatus) (\s :: UpdateStandardsControl
s@UpdateStandardsControl' {} Maybe ControlStatus
a -> UpdateStandardsControl
s {$sel:controlStatus:UpdateStandardsControl' :: Maybe ControlStatus
controlStatus = Maybe ControlStatus
a} :: UpdateStandardsControl)

-- | A description of the reason why you are disabling a security standard
-- control. If you are disabling a control, then this is required.
updateStandardsControl_disabledReason :: Lens.Lens' UpdateStandardsControl (Prelude.Maybe Prelude.Text)
updateStandardsControl_disabledReason :: (Maybe Text -> f (Maybe Text))
-> UpdateStandardsControl -> f UpdateStandardsControl
updateStandardsControl_disabledReason = (UpdateStandardsControl -> Maybe Text)
-> (UpdateStandardsControl -> Maybe Text -> UpdateStandardsControl)
-> Lens
     UpdateStandardsControl
     UpdateStandardsControl
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateStandardsControl' {Maybe Text
disabledReason :: Maybe Text
$sel:disabledReason:UpdateStandardsControl' :: UpdateStandardsControl -> Maybe Text
disabledReason} -> Maybe Text
disabledReason) (\s :: UpdateStandardsControl
s@UpdateStandardsControl' {} Maybe Text
a -> UpdateStandardsControl
s {$sel:disabledReason:UpdateStandardsControl' :: Maybe Text
disabledReason = Maybe Text
a} :: UpdateStandardsControl)

-- | The ARN of the security standard control to enable or disable.
updateStandardsControl_standardsControlArn :: Lens.Lens' UpdateStandardsControl Prelude.Text
updateStandardsControl_standardsControlArn :: (Text -> f Text)
-> UpdateStandardsControl -> f UpdateStandardsControl
updateStandardsControl_standardsControlArn = (UpdateStandardsControl -> Text)
-> (UpdateStandardsControl -> Text -> UpdateStandardsControl)
-> Lens UpdateStandardsControl UpdateStandardsControl Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateStandardsControl' {Text
standardsControlArn :: Text
$sel:standardsControlArn:UpdateStandardsControl' :: UpdateStandardsControl -> Text
standardsControlArn} -> Text
standardsControlArn) (\s :: UpdateStandardsControl
s@UpdateStandardsControl' {} Text
a -> UpdateStandardsControl
s {$sel:standardsControlArn:UpdateStandardsControl' :: Text
standardsControlArn = Text
a} :: UpdateStandardsControl)

instance Core.AWSRequest UpdateStandardsControl where
  type
    AWSResponse UpdateStandardsControl =
      UpdateStandardsControlResponse
  request :: UpdateStandardsControl -> Request UpdateStandardsControl
request = Service -> UpdateStandardsControl -> Request UpdateStandardsControl
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.patchJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy UpdateStandardsControl
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateStandardsControl)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse UpdateStandardsControl))
-> Logger
-> Service
-> Proxy UpdateStandardsControl
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateStandardsControl)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> UpdateStandardsControlResponse
UpdateStandardsControlResponse'
            (Int -> UpdateStandardsControlResponse)
-> Either String Int
-> Either String UpdateStandardsControlResponse
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))
      )

instance Prelude.Hashable UpdateStandardsControl

instance Prelude.NFData UpdateStandardsControl

instance Core.ToHeaders UpdateStandardsControl where
  toHeaders :: UpdateStandardsControl -> ResponseHeaders
toHeaders =
    ResponseHeaders -> UpdateStandardsControl -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON UpdateStandardsControl where
  toJSON :: UpdateStandardsControl -> Value
toJSON UpdateStandardsControl' {Maybe Text
Maybe ControlStatus
Text
standardsControlArn :: Text
disabledReason :: Maybe Text
controlStatus :: Maybe ControlStatus
$sel:standardsControlArn:UpdateStandardsControl' :: UpdateStandardsControl -> Text
$sel:disabledReason:UpdateStandardsControl' :: UpdateStandardsControl -> Maybe Text
$sel:controlStatus:UpdateStandardsControl' :: UpdateStandardsControl -> Maybe ControlStatus
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"ControlStatus" Text -> ControlStatus -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ControlStatus -> Pair) -> Maybe ControlStatus -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ControlStatus
controlStatus,
            (Text
"DisabledReason" 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
disabledReason
          ]
      )

instance Core.ToPath UpdateStandardsControl where
  toPath :: UpdateStandardsControl -> ByteString
toPath UpdateStandardsControl' {Maybe Text
Maybe ControlStatus
Text
standardsControlArn :: Text
disabledReason :: Maybe Text
controlStatus :: Maybe ControlStatus
$sel:standardsControlArn:UpdateStandardsControl' :: UpdateStandardsControl -> Text
$sel:disabledReason:UpdateStandardsControl' :: UpdateStandardsControl -> Maybe Text
$sel:controlStatus:UpdateStandardsControl' :: UpdateStandardsControl -> Maybe ControlStatus
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/standards/control/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
standardsControlArn
      ]

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

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

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

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

instance
  Prelude.NFData
    UpdateStandardsControlResponse