{-# 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.AuditManager.CreateControl
-- 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)
--
-- Creates a new custom control in Audit Manager.
module Amazonka.AuditManager.CreateControl
  ( -- * Creating a Request
    CreateControl (..),
    newCreateControl,

    -- * Request Lenses
    createControl_testingInformation,
    createControl_actionPlanInstructions,
    createControl_actionPlanTitle,
    createControl_description,
    createControl_tags,
    createControl_name,
    createControl_controlMappingSources,

    -- * Destructuring the Response
    CreateControlResponse (..),
    newCreateControlResponse,

    -- * Response Lenses
    createControlResponse_control,
    createControlResponse_httpStatus,
  )
where

import Amazonka.AuditManager.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

-- | /See:/ 'newCreateControl' smart constructor.
data CreateControl = CreateControl'
  { -- | The steps to follow to determine if the control has been satisfied.
    CreateControl -> Maybe Text
testingInformation :: Prelude.Maybe Prelude.Text,
    -- | The recommended actions to carry out if the control is not fulfilled.
    CreateControl -> Maybe Text
actionPlanInstructions :: Prelude.Maybe Prelude.Text,
    -- | The title of the action plan for remediating the control.
    CreateControl -> Maybe Text
actionPlanTitle :: Prelude.Maybe Prelude.Text,
    -- | The description of the control.
    CreateControl -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The tags associated with the control.
    CreateControl -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The name of the control.
    CreateControl -> Text
name :: Prelude.Text,
    -- | The data mapping sources for the specified control.
    CreateControl -> NonEmpty CreateControlMappingSource
controlMappingSources :: Prelude.NonEmpty CreateControlMappingSource
  }
  deriving (CreateControl -> CreateControl -> Bool
(CreateControl -> CreateControl -> Bool)
-> (CreateControl -> CreateControl -> Bool) -> Eq CreateControl
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateControl -> CreateControl -> Bool
$c/= :: CreateControl -> CreateControl -> Bool
== :: CreateControl -> CreateControl -> Bool
$c== :: CreateControl -> CreateControl -> Bool
Prelude.Eq, ReadPrec [CreateControl]
ReadPrec CreateControl
Int -> ReadS CreateControl
ReadS [CreateControl]
(Int -> ReadS CreateControl)
-> ReadS [CreateControl]
-> ReadPrec CreateControl
-> ReadPrec [CreateControl]
-> Read CreateControl
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateControl]
$creadListPrec :: ReadPrec [CreateControl]
readPrec :: ReadPrec CreateControl
$creadPrec :: ReadPrec CreateControl
readList :: ReadS [CreateControl]
$creadList :: ReadS [CreateControl]
readsPrec :: Int -> ReadS CreateControl
$creadsPrec :: Int -> ReadS CreateControl
Prelude.Read, Int -> CreateControl -> ShowS
[CreateControl] -> ShowS
CreateControl -> String
(Int -> CreateControl -> ShowS)
-> (CreateControl -> String)
-> ([CreateControl] -> ShowS)
-> Show CreateControl
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateControl] -> ShowS
$cshowList :: [CreateControl] -> ShowS
show :: CreateControl -> String
$cshow :: CreateControl -> String
showsPrec :: Int -> CreateControl -> ShowS
$cshowsPrec :: Int -> CreateControl -> ShowS
Prelude.Show, (forall x. CreateControl -> Rep CreateControl x)
-> (forall x. Rep CreateControl x -> CreateControl)
-> Generic CreateControl
forall x. Rep CreateControl x -> CreateControl
forall x. CreateControl -> Rep CreateControl x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateControl x -> CreateControl
$cfrom :: forall x. CreateControl -> Rep CreateControl x
Prelude.Generic)

-- |
-- Create a value of 'CreateControl' 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:
--
-- 'testingInformation', 'createControl_testingInformation' - The steps to follow to determine if the control has been satisfied.
--
-- 'actionPlanInstructions', 'createControl_actionPlanInstructions' - The recommended actions to carry out if the control is not fulfilled.
--
-- 'actionPlanTitle', 'createControl_actionPlanTitle' - The title of the action plan for remediating the control.
--
-- 'description', 'createControl_description' - The description of the control.
--
-- 'tags', 'createControl_tags' - The tags associated with the control.
--
-- 'name', 'createControl_name' - The name of the control.
--
-- 'controlMappingSources', 'createControl_controlMappingSources' - The data mapping sources for the specified control.
newCreateControl ::
  -- | 'name'
  Prelude.Text ->
  -- | 'controlMappingSources'
  Prelude.NonEmpty CreateControlMappingSource ->
  CreateControl
newCreateControl :: Text -> NonEmpty CreateControlMappingSource -> CreateControl
newCreateControl Text
pName_ NonEmpty CreateControlMappingSource
pControlMappingSources_ =
  CreateControl' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Text
-> NonEmpty CreateControlMappingSource
-> CreateControl
CreateControl'
    { $sel:testingInformation:CreateControl' :: Maybe Text
testingInformation =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:actionPlanInstructions:CreateControl' :: Maybe Text
actionPlanInstructions = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:actionPlanTitle:CreateControl' :: Maybe Text
actionPlanTitle = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:CreateControl' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:CreateControl' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:name:CreateControl' :: Text
name = Text
pName_,
      $sel:controlMappingSources:CreateControl' :: NonEmpty CreateControlMappingSource
controlMappingSources =
        Tagged
  (NonEmpty CreateControlMappingSource)
  (Identity (NonEmpty CreateControlMappingSource))
-> Tagged
     (NonEmpty CreateControlMappingSource)
     (Identity (NonEmpty CreateControlMappingSource))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged
   (NonEmpty CreateControlMappingSource)
   (Identity (NonEmpty CreateControlMappingSource))
 -> Tagged
      (NonEmpty CreateControlMappingSource)
      (Identity (NonEmpty CreateControlMappingSource)))
-> NonEmpty CreateControlMappingSource
-> NonEmpty CreateControlMappingSource
forall t b. AReview t b -> b -> t
Lens.# NonEmpty CreateControlMappingSource
pControlMappingSources_
    }

-- | The steps to follow to determine if the control has been satisfied.
createControl_testingInformation :: Lens.Lens' CreateControl (Prelude.Maybe Prelude.Text)
createControl_testingInformation :: (Maybe Text -> f (Maybe Text)) -> CreateControl -> f CreateControl
createControl_testingInformation = (CreateControl -> Maybe Text)
-> (CreateControl -> Maybe Text -> CreateControl)
-> Lens CreateControl CreateControl (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateControl' {Maybe Text
testingInformation :: Maybe Text
$sel:testingInformation:CreateControl' :: CreateControl -> Maybe Text
testingInformation} -> Maybe Text
testingInformation) (\s :: CreateControl
s@CreateControl' {} Maybe Text
a -> CreateControl
s {$sel:testingInformation:CreateControl' :: Maybe Text
testingInformation = Maybe Text
a} :: CreateControl)

-- | The recommended actions to carry out if the control is not fulfilled.
createControl_actionPlanInstructions :: Lens.Lens' CreateControl (Prelude.Maybe Prelude.Text)
createControl_actionPlanInstructions :: (Maybe Text -> f (Maybe Text)) -> CreateControl -> f CreateControl
createControl_actionPlanInstructions = (CreateControl -> Maybe Text)
-> (CreateControl -> Maybe Text -> CreateControl)
-> Lens CreateControl CreateControl (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateControl' {Maybe Text
actionPlanInstructions :: Maybe Text
$sel:actionPlanInstructions:CreateControl' :: CreateControl -> Maybe Text
actionPlanInstructions} -> Maybe Text
actionPlanInstructions) (\s :: CreateControl
s@CreateControl' {} Maybe Text
a -> CreateControl
s {$sel:actionPlanInstructions:CreateControl' :: Maybe Text
actionPlanInstructions = Maybe Text
a} :: CreateControl)

-- | The title of the action plan for remediating the control.
createControl_actionPlanTitle :: Lens.Lens' CreateControl (Prelude.Maybe Prelude.Text)
createControl_actionPlanTitle :: (Maybe Text -> f (Maybe Text)) -> CreateControl -> f CreateControl
createControl_actionPlanTitle = (CreateControl -> Maybe Text)
-> (CreateControl -> Maybe Text -> CreateControl)
-> Lens CreateControl CreateControl (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateControl' {Maybe Text
actionPlanTitle :: Maybe Text
$sel:actionPlanTitle:CreateControl' :: CreateControl -> Maybe Text
actionPlanTitle} -> Maybe Text
actionPlanTitle) (\s :: CreateControl
s@CreateControl' {} Maybe Text
a -> CreateControl
s {$sel:actionPlanTitle:CreateControl' :: Maybe Text
actionPlanTitle = Maybe Text
a} :: CreateControl)

-- | The description of the control.
createControl_description :: Lens.Lens' CreateControl (Prelude.Maybe Prelude.Text)
createControl_description :: (Maybe Text -> f (Maybe Text)) -> CreateControl -> f CreateControl
createControl_description = (CreateControl -> Maybe Text)
-> (CreateControl -> Maybe Text -> CreateControl)
-> Lens CreateControl CreateControl (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateControl' {Maybe Text
description :: Maybe Text
$sel:description:CreateControl' :: CreateControl -> Maybe Text
description} -> Maybe Text
description) (\s :: CreateControl
s@CreateControl' {} Maybe Text
a -> CreateControl
s {$sel:description:CreateControl' :: Maybe Text
description = Maybe Text
a} :: CreateControl)

-- | The tags associated with the control.
createControl_tags :: Lens.Lens' CreateControl (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createControl_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateControl -> f CreateControl
createControl_tags = (CreateControl -> Maybe (HashMap Text Text))
-> (CreateControl -> Maybe (HashMap Text Text) -> CreateControl)
-> Lens
     CreateControl
     CreateControl
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateControl' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateControl' :: CreateControl -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateControl
s@CreateControl' {} Maybe (HashMap Text Text)
a -> CreateControl
s {$sel:tags:CreateControl' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateControl) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> CreateControl -> f CreateControl)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateControl
-> f CreateControl
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
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 AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name of the control.
createControl_name :: Lens.Lens' CreateControl Prelude.Text
createControl_name :: (Text -> f Text) -> CreateControl -> f CreateControl
createControl_name = (CreateControl -> Text)
-> (CreateControl -> Text -> CreateControl)
-> Lens CreateControl CreateControl Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateControl' {Text
name :: Text
$sel:name:CreateControl' :: CreateControl -> Text
name} -> Text
name) (\s :: CreateControl
s@CreateControl' {} Text
a -> CreateControl
s {$sel:name:CreateControl' :: Text
name = Text
a} :: CreateControl)

-- | The data mapping sources for the specified control.
createControl_controlMappingSources :: Lens.Lens' CreateControl (Prelude.NonEmpty CreateControlMappingSource)
createControl_controlMappingSources :: (NonEmpty CreateControlMappingSource
 -> f (NonEmpty CreateControlMappingSource))
-> CreateControl -> f CreateControl
createControl_controlMappingSources = (CreateControl -> NonEmpty CreateControlMappingSource)
-> (CreateControl
    -> NonEmpty CreateControlMappingSource -> CreateControl)
-> Lens
     CreateControl
     CreateControl
     (NonEmpty CreateControlMappingSource)
     (NonEmpty CreateControlMappingSource)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateControl' {NonEmpty CreateControlMappingSource
controlMappingSources :: NonEmpty CreateControlMappingSource
$sel:controlMappingSources:CreateControl' :: CreateControl -> NonEmpty CreateControlMappingSource
controlMappingSources} -> NonEmpty CreateControlMappingSource
controlMappingSources) (\s :: CreateControl
s@CreateControl' {} NonEmpty CreateControlMappingSource
a -> CreateControl
s {$sel:controlMappingSources:CreateControl' :: NonEmpty CreateControlMappingSource
controlMappingSources = NonEmpty CreateControlMappingSource
a} :: CreateControl) ((NonEmpty CreateControlMappingSource
  -> f (NonEmpty CreateControlMappingSource))
 -> CreateControl -> f CreateControl)
-> ((NonEmpty CreateControlMappingSource
     -> f (NonEmpty CreateControlMappingSource))
    -> NonEmpty CreateControlMappingSource
    -> f (NonEmpty CreateControlMappingSource))
-> (NonEmpty CreateControlMappingSource
    -> f (NonEmpty CreateControlMappingSource))
-> CreateControl
-> f CreateControl
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty CreateControlMappingSource
 -> f (NonEmpty CreateControlMappingSource))
-> NonEmpty CreateControlMappingSource
-> f (NonEmpty CreateControlMappingSource)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.AWSRequest CreateControl where
  type
    AWSResponse CreateControl =
      CreateControlResponse
  request :: CreateControl -> Request CreateControl
request = Service -> CreateControl -> Request CreateControl
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateControl
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateControl)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateControl))
-> Logger
-> Service
-> Proxy CreateControl
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateControl)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Control -> Int -> CreateControlResponse
CreateControlResponse'
            (Maybe Control -> Int -> CreateControlResponse)
-> Either String (Maybe Control)
-> Either String (Int -> CreateControlResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Control)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"control")
            Either String (Int -> CreateControlResponse)
-> Either String Int -> Either String CreateControlResponse
forall (f :: * -> *) a b. Applicative f => 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 CreateControl

instance Prelude.NFData CreateControl

instance Core.ToHeaders CreateControl where
  toHeaders :: CreateControl -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateControl -> 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 CreateControl where
  toJSON :: CreateControl -> Value
toJSON CreateControl' {Maybe Text
Maybe (HashMap Text Text)
NonEmpty CreateControlMappingSource
Text
controlMappingSources :: NonEmpty CreateControlMappingSource
name :: Text
tags :: Maybe (HashMap Text Text)
description :: Maybe Text
actionPlanTitle :: Maybe Text
actionPlanInstructions :: Maybe Text
testingInformation :: Maybe Text
$sel:controlMappingSources:CreateControl' :: CreateControl -> NonEmpty CreateControlMappingSource
$sel:name:CreateControl' :: CreateControl -> Text
$sel:tags:CreateControl' :: CreateControl -> Maybe (HashMap Text Text)
$sel:description:CreateControl' :: CreateControl -> Maybe Text
$sel:actionPlanTitle:CreateControl' :: CreateControl -> Maybe Text
$sel:actionPlanInstructions:CreateControl' :: CreateControl -> Maybe Text
$sel:testingInformation:CreateControl' :: CreateControl -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"testingInformation" 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
testingInformation,
            (Text
"actionPlanInstructions" 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
actionPlanInstructions,
            (Text
"actionPlanTitle" 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
actionPlanTitle,
            (Text
"description" 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
description,
            (Text
"tags" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
tags,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"controlMappingSources"
                  Text -> NonEmpty CreateControlMappingSource -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty CreateControlMappingSource
controlMappingSources
              )
          ]
      )

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

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

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

-- |
-- Create a value of 'CreateControlResponse' 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:
--
-- 'control', 'createControlResponse_control' - The new control returned by the @CreateControl@ API.
--
-- 'httpStatus', 'createControlResponse_httpStatus' - The response's http status code.
newCreateControlResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateControlResponse
newCreateControlResponse :: Int -> CreateControlResponse
newCreateControlResponse Int
pHttpStatus_ =
  CreateControlResponse' :: Maybe Control -> Int -> CreateControlResponse
CreateControlResponse'
    { $sel:control:CreateControlResponse' :: Maybe Control
control = Maybe Control
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateControlResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The new control returned by the @CreateControl@ API.
createControlResponse_control :: Lens.Lens' CreateControlResponse (Prelude.Maybe Control)
createControlResponse_control :: (Maybe Control -> f (Maybe Control))
-> CreateControlResponse -> f CreateControlResponse
createControlResponse_control = (CreateControlResponse -> Maybe Control)
-> (CreateControlResponse
    -> Maybe Control -> CreateControlResponse)
-> Lens
     CreateControlResponse
     CreateControlResponse
     (Maybe Control)
     (Maybe Control)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateControlResponse' {Maybe Control
control :: Maybe Control
$sel:control:CreateControlResponse' :: CreateControlResponse -> Maybe Control
control} -> Maybe Control
control) (\s :: CreateControlResponse
s@CreateControlResponse' {} Maybe Control
a -> CreateControlResponse
s {$sel:control:CreateControlResponse' :: Maybe Control
control = Maybe Control
a} :: CreateControlResponse)

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

instance Prelude.NFData CreateControlResponse