{-# 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.IoT.CreateScheduledAudit
-- 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 scheduled audit that is run at a specified time interval.
--
-- Requires permission to access the
-- <https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions CreateScheduledAudit>
-- action.
module Amazonka.IoT.CreateScheduledAudit
  ( -- * Creating a Request
    CreateScheduledAudit (..),
    newCreateScheduledAudit,

    -- * Request Lenses
    createScheduledAudit_dayOfMonth,
    createScheduledAudit_dayOfWeek,
    createScheduledAudit_tags,
    createScheduledAudit_frequency,
    createScheduledAudit_targetCheckNames,
    createScheduledAudit_scheduledAuditName,

    -- * Destructuring the Response
    CreateScheduledAuditResponse (..),
    newCreateScheduledAuditResponse,

    -- * Response Lenses
    createScheduledAuditResponse_scheduledAuditArn,
    createScheduledAuditResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.IoT.Types
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:/ 'newCreateScheduledAudit' smart constructor.
data CreateScheduledAudit = CreateScheduledAudit'
  { -- | The day of the month on which the scheduled audit takes place. This can
    -- be \"1\" through \"31\" or \"LAST\". This field is required if the
    -- \"frequency\" parameter is set to @MONTHLY@. If days 29 to 31 are
    -- specified, and the month doesn\'t have that many days, the audit takes
    -- place on the @LAST@ day of the month.
    CreateScheduledAudit -> Maybe Text
dayOfMonth :: Prelude.Maybe Prelude.Text,
    -- | The day of the week on which the scheduled audit takes place, either
    -- @SUN@, @MON@, @TUE@, @WED@, @THU@, @FRI@, or @SAT@. This field is
    -- required if the @frequency@ parameter is set to @WEEKLY@ or @BIWEEKLY@.
    CreateScheduledAudit -> Maybe DayOfWeek
dayOfWeek :: Prelude.Maybe DayOfWeek,
    -- | Metadata that can be used to manage the scheduled audit.
    CreateScheduledAudit -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | How often the scheduled audit takes place, either @DAILY@, @WEEKLY@,
    -- @BIWEEKLY@ or @MONTHLY@. The start time of each audit is determined by
    -- the system.
    CreateScheduledAudit -> AuditFrequency
frequency :: AuditFrequency,
    -- | Which checks are performed during the scheduled audit. Checks must be
    -- enabled for your account. (Use @DescribeAccountAuditConfiguration@ to
    -- see the list of all checks, including those that are enabled or use
    -- @UpdateAccountAuditConfiguration@ to select which checks are enabled.)
    CreateScheduledAudit -> [Text]
targetCheckNames :: [Prelude.Text],
    -- | The name you want to give to the scheduled audit. (Max. 128 chars)
    CreateScheduledAudit -> Text
scheduledAuditName :: Prelude.Text
  }
  deriving (CreateScheduledAudit -> CreateScheduledAudit -> Bool
(CreateScheduledAudit -> CreateScheduledAudit -> Bool)
-> (CreateScheduledAudit -> CreateScheduledAudit -> Bool)
-> Eq CreateScheduledAudit
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateScheduledAudit -> CreateScheduledAudit -> Bool
$c/= :: CreateScheduledAudit -> CreateScheduledAudit -> Bool
== :: CreateScheduledAudit -> CreateScheduledAudit -> Bool
$c== :: CreateScheduledAudit -> CreateScheduledAudit -> Bool
Prelude.Eq, ReadPrec [CreateScheduledAudit]
ReadPrec CreateScheduledAudit
Int -> ReadS CreateScheduledAudit
ReadS [CreateScheduledAudit]
(Int -> ReadS CreateScheduledAudit)
-> ReadS [CreateScheduledAudit]
-> ReadPrec CreateScheduledAudit
-> ReadPrec [CreateScheduledAudit]
-> Read CreateScheduledAudit
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateScheduledAudit]
$creadListPrec :: ReadPrec [CreateScheduledAudit]
readPrec :: ReadPrec CreateScheduledAudit
$creadPrec :: ReadPrec CreateScheduledAudit
readList :: ReadS [CreateScheduledAudit]
$creadList :: ReadS [CreateScheduledAudit]
readsPrec :: Int -> ReadS CreateScheduledAudit
$creadsPrec :: Int -> ReadS CreateScheduledAudit
Prelude.Read, Int -> CreateScheduledAudit -> ShowS
[CreateScheduledAudit] -> ShowS
CreateScheduledAudit -> String
(Int -> CreateScheduledAudit -> ShowS)
-> (CreateScheduledAudit -> String)
-> ([CreateScheduledAudit] -> ShowS)
-> Show CreateScheduledAudit
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateScheduledAudit] -> ShowS
$cshowList :: [CreateScheduledAudit] -> ShowS
show :: CreateScheduledAudit -> String
$cshow :: CreateScheduledAudit -> String
showsPrec :: Int -> CreateScheduledAudit -> ShowS
$cshowsPrec :: Int -> CreateScheduledAudit -> ShowS
Prelude.Show, (forall x. CreateScheduledAudit -> Rep CreateScheduledAudit x)
-> (forall x. Rep CreateScheduledAudit x -> CreateScheduledAudit)
-> Generic CreateScheduledAudit
forall x. Rep CreateScheduledAudit x -> CreateScheduledAudit
forall x. CreateScheduledAudit -> Rep CreateScheduledAudit x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateScheduledAudit x -> CreateScheduledAudit
$cfrom :: forall x. CreateScheduledAudit -> Rep CreateScheduledAudit x
Prelude.Generic)

-- |
-- Create a value of 'CreateScheduledAudit' 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:
--
-- 'dayOfMonth', 'createScheduledAudit_dayOfMonth' - The day of the month on which the scheduled audit takes place. This can
-- be \"1\" through \"31\" or \"LAST\". This field is required if the
-- \"frequency\" parameter is set to @MONTHLY@. If days 29 to 31 are
-- specified, and the month doesn\'t have that many days, the audit takes
-- place on the @LAST@ day of the month.
--
-- 'dayOfWeek', 'createScheduledAudit_dayOfWeek' - The day of the week on which the scheduled audit takes place, either
-- @SUN@, @MON@, @TUE@, @WED@, @THU@, @FRI@, or @SAT@. This field is
-- required if the @frequency@ parameter is set to @WEEKLY@ or @BIWEEKLY@.
--
-- 'tags', 'createScheduledAudit_tags' - Metadata that can be used to manage the scheduled audit.
--
-- 'frequency', 'createScheduledAudit_frequency' - How often the scheduled audit takes place, either @DAILY@, @WEEKLY@,
-- @BIWEEKLY@ or @MONTHLY@. The start time of each audit is determined by
-- the system.
--
-- 'targetCheckNames', 'createScheduledAudit_targetCheckNames' - Which checks are performed during the scheduled audit. Checks must be
-- enabled for your account. (Use @DescribeAccountAuditConfiguration@ to
-- see the list of all checks, including those that are enabled or use
-- @UpdateAccountAuditConfiguration@ to select which checks are enabled.)
--
-- 'scheduledAuditName', 'createScheduledAudit_scheduledAuditName' - The name you want to give to the scheduled audit. (Max. 128 chars)
newCreateScheduledAudit ::
  -- | 'frequency'
  AuditFrequency ->
  -- | 'scheduledAuditName'
  Prelude.Text ->
  CreateScheduledAudit
newCreateScheduledAudit :: AuditFrequency -> Text -> CreateScheduledAudit
newCreateScheduledAudit
  AuditFrequency
pFrequency_
  Text
pScheduledAuditName_ =
    CreateScheduledAudit' :: Maybe Text
-> Maybe DayOfWeek
-> Maybe [Tag]
-> AuditFrequency
-> [Text]
-> Text
-> CreateScheduledAudit
CreateScheduledAudit'
      { $sel:dayOfMonth:CreateScheduledAudit' :: Maybe Text
dayOfMonth = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:dayOfWeek:CreateScheduledAudit' :: Maybe DayOfWeek
dayOfWeek = Maybe DayOfWeek
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateScheduledAudit' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
        $sel:frequency:CreateScheduledAudit' :: AuditFrequency
frequency = AuditFrequency
pFrequency_,
        $sel:targetCheckNames:CreateScheduledAudit' :: [Text]
targetCheckNames = [Text]
forall a. Monoid a => a
Prelude.mempty,
        $sel:scheduledAuditName:CreateScheduledAudit' :: Text
scheduledAuditName = Text
pScheduledAuditName_
      }

-- | The day of the month on which the scheduled audit takes place. This can
-- be \"1\" through \"31\" or \"LAST\". This field is required if the
-- \"frequency\" parameter is set to @MONTHLY@. If days 29 to 31 are
-- specified, and the month doesn\'t have that many days, the audit takes
-- place on the @LAST@ day of the month.
createScheduledAudit_dayOfMonth :: Lens.Lens' CreateScheduledAudit (Prelude.Maybe Prelude.Text)
createScheduledAudit_dayOfMonth :: (Maybe Text -> f (Maybe Text))
-> CreateScheduledAudit -> f CreateScheduledAudit
createScheduledAudit_dayOfMonth = (CreateScheduledAudit -> Maybe Text)
-> (CreateScheduledAudit -> Maybe Text -> CreateScheduledAudit)
-> Lens
     CreateScheduledAudit CreateScheduledAudit (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateScheduledAudit' {Maybe Text
dayOfMonth :: Maybe Text
$sel:dayOfMonth:CreateScheduledAudit' :: CreateScheduledAudit -> Maybe Text
dayOfMonth} -> Maybe Text
dayOfMonth) (\s :: CreateScheduledAudit
s@CreateScheduledAudit' {} Maybe Text
a -> CreateScheduledAudit
s {$sel:dayOfMonth:CreateScheduledAudit' :: Maybe Text
dayOfMonth = Maybe Text
a} :: CreateScheduledAudit)

-- | The day of the week on which the scheduled audit takes place, either
-- @SUN@, @MON@, @TUE@, @WED@, @THU@, @FRI@, or @SAT@. This field is
-- required if the @frequency@ parameter is set to @WEEKLY@ or @BIWEEKLY@.
createScheduledAudit_dayOfWeek :: Lens.Lens' CreateScheduledAudit (Prelude.Maybe DayOfWeek)
createScheduledAudit_dayOfWeek :: (Maybe DayOfWeek -> f (Maybe DayOfWeek))
-> CreateScheduledAudit -> f CreateScheduledAudit
createScheduledAudit_dayOfWeek = (CreateScheduledAudit -> Maybe DayOfWeek)
-> (CreateScheduledAudit
    -> Maybe DayOfWeek -> CreateScheduledAudit)
-> Lens
     CreateScheduledAudit
     CreateScheduledAudit
     (Maybe DayOfWeek)
     (Maybe DayOfWeek)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateScheduledAudit' {Maybe DayOfWeek
dayOfWeek :: Maybe DayOfWeek
$sel:dayOfWeek:CreateScheduledAudit' :: CreateScheduledAudit -> Maybe DayOfWeek
dayOfWeek} -> Maybe DayOfWeek
dayOfWeek) (\s :: CreateScheduledAudit
s@CreateScheduledAudit' {} Maybe DayOfWeek
a -> CreateScheduledAudit
s {$sel:dayOfWeek:CreateScheduledAudit' :: Maybe DayOfWeek
dayOfWeek = Maybe DayOfWeek
a} :: CreateScheduledAudit)

-- | Metadata that can be used to manage the scheduled audit.
createScheduledAudit_tags :: Lens.Lens' CreateScheduledAudit (Prelude.Maybe [Tag])
createScheduledAudit_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateScheduledAudit -> f CreateScheduledAudit
createScheduledAudit_tags = (CreateScheduledAudit -> Maybe [Tag])
-> (CreateScheduledAudit -> Maybe [Tag] -> CreateScheduledAudit)
-> Lens
     CreateScheduledAudit
     CreateScheduledAudit
     (Maybe [Tag])
     (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateScheduledAudit' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateScheduledAudit' :: CreateScheduledAudit -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateScheduledAudit
s@CreateScheduledAudit' {} Maybe [Tag]
a -> CreateScheduledAudit
s {$sel:tags:CreateScheduledAudit' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateScheduledAudit) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> CreateScheduledAudit -> f CreateScheduledAudit)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateScheduledAudit
-> f CreateScheduledAudit
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
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 [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | How often the scheduled audit takes place, either @DAILY@, @WEEKLY@,
-- @BIWEEKLY@ or @MONTHLY@. The start time of each audit is determined by
-- the system.
createScheduledAudit_frequency :: Lens.Lens' CreateScheduledAudit AuditFrequency
createScheduledAudit_frequency :: (AuditFrequency -> f AuditFrequency)
-> CreateScheduledAudit -> f CreateScheduledAudit
createScheduledAudit_frequency = (CreateScheduledAudit -> AuditFrequency)
-> (CreateScheduledAudit -> AuditFrequency -> CreateScheduledAudit)
-> Lens
     CreateScheduledAudit
     CreateScheduledAudit
     AuditFrequency
     AuditFrequency
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateScheduledAudit' {AuditFrequency
frequency :: AuditFrequency
$sel:frequency:CreateScheduledAudit' :: CreateScheduledAudit -> AuditFrequency
frequency} -> AuditFrequency
frequency) (\s :: CreateScheduledAudit
s@CreateScheduledAudit' {} AuditFrequency
a -> CreateScheduledAudit
s {$sel:frequency:CreateScheduledAudit' :: AuditFrequency
frequency = AuditFrequency
a} :: CreateScheduledAudit)

-- | Which checks are performed during the scheduled audit. Checks must be
-- enabled for your account. (Use @DescribeAccountAuditConfiguration@ to
-- see the list of all checks, including those that are enabled or use
-- @UpdateAccountAuditConfiguration@ to select which checks are enabled.)
createScheduledAudit_targetCheckNames :: Lens.Lens' CreateScheduledAudit [Prelude.Text]
createScheduledAudit_targetCheckNames :: ([Text] -> f [Text])
-> CreateScheduledAudit -> f CreateScheduledAudit
createScheduledAudit_targetCheckNames = (CreateScheduledAudit -> [Text])
-> (CreateScheduledAudit -> [Text] -> CreateScheduledAudit)
-> Lens CreateScheduledAudit CreateScheduledAudit [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateScheduledAudit' {[Text]
targetCheckNames :: [Text]
$sel:targetCheckNames:CreateScheduledAudit' :: CreateScheduledAudit -> [Text]
targetCheckNames} -> [Text]
targetCheckNames) (\s :: CreateScheduledAudit
s@CreateScheduledAudit' {} [Text]
a -> CreateScheduledAudit
s {$sel:targetCheckNames:CreateScheduledAudit' :: [Text]
targetCheckNames = [Text]
a} :: CreateScheduledAudit) (([Text] -> f [Text])
 -> CreateScheduledAudit -> f CreateScheduledAudit)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> CreateScheduledAudit
-> f CreateScheduledAudit
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name you want to give to the scheduled audit. (Max. 128 chars)
createScheduledAudit_scheduledAuditName :: Lens.Lens' CreateScheduledAudit Prelude.Text
createScheduledAudit_scheduledAuditName :: (Text -> f Text) -> CreateScheduledAudit -> f CreateScheduledAudit
createScheduledAudit_scheduledAuditName = (CreateScheduledAudit -> Text)
-> (CreateScheduledAudit -> Text -> CreateScheduledAudit)
-> Lens CreateScheduledAudit CreateScheduledAudit Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateScheduledAudit' {Text
scheduledAuditName :: Text
$sel:scheduledAuditName:CreateScheduledAudit' :: CreateScheduledAudit -> Text
scheduledAuditName} -> Text
scheduledAuditName) (\s :: CreateScheduledAudit
s@CreateScheduledAudit' {} Text
a -> CreateScheduledAudit
s {$sel:scheduledAuditName:CreateScheduledAudit' :: Text
scheduledAuditName = Text
a} :: CreateScheduledAudit)

instance Core.AWSRequest CreateScheduledAudit where
  type
    AWSResponse CreateScheduledAudit =
      CreateScheduledAuditResponse
  request :: CreateScheduledAudit -> Request CreateScheduledAudit
request = Service -> CreateScheduledAudit -> Request CreateScheduledAudit
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateScheduledAudit
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateScheduledAudit)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateScheduledAudit))
-> Logger
-> Service
-> Proxy CreateScheduledAudit
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateScheduledAudit)))
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 Text -> Int -> CreateScheduledAuditResponse
CreateScheduledAuditResponse'
            (Maybe Text -> Int -> CreateScheduledAuditResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateScheduledAuditResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"scheduledAuditArn")
            Either String (Int -> CreateScheduledAuditResponse)
-> Either String Int -> Either String CreateScheduledAuditResponse
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 CreateScheduledAudit

instance Prelude.NFData CreateScheduledAudit

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

instance Core.ToJSON CreateScheduledAudit where
  toJSON :: CreateScheduledAudit -> Value
toJSON CreateScheduledAudit' {[Text]
Maybe [Tag]
Maybe Text
Maybe DayOfWeek
Text
AuditFrequency
scheduledAuditName :: Text
targetCheckNames :: [Text]
frequency :: AuditFrequency
tags :: Maybe [Tag]
dayOfWeek :: Maybe DayOfWeek
dayOfMonth :: Maybe Text
$sel:scheduledAuditName:CreateScheduledAudit' :: CreateScheduledAudit -> Text
$sel:targetCheckNames:CreateScheduledAudit' :: CreateScheduledAudit -> [Text]
$sel:frequency:CreateScheduledAudit' :: CreateScheduledAudit -> AuditFrequency
$sel:tags:CreateScheduledAudit' :: CreateScheduledAudit -> Maybe [Tag]
$sel:dayOfWeek:CreateScheduledAudit' :: CreateScheduledAudit -> Maybe DayOfWeek
$sel:dayOfMonth:CreateScheduledAudit' :: CreateScheduledAudit -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"dayOfMonth" 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
dayOfMonth,
            (Text
"dayOfWeek" Text -> DayOfWeek -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (DayOfWeek -> Pair) -> Maybe DayOfWeek -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe DayOfWeek
dayOfWeek,
            (Text
"tags" Text -> [Tag] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Tag] -> Pair) -> Maybe [Tag] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"frequency" Text -> AuditFrequency -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= AuditFrequency
frequency),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"targetCheckNames" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Text]
targetCheckNames)
          ]
      )

instance Core.ToPath CreateScheduledAudit where
  toPath :: CreateScheduledAudit -> ByteString
toPath CreateScheduledAudit' {[Text]
Maybe [Tag]
Maybe Text
Maybe DayOfWeek
Text
AuditFrequency
scheduledAuditName :: Text
targetCheckNames :: [Text]
frequency :: AuditFrequency
tags :: Maybe [Tag]
dayOfWeek :: Maybe DayOfWeek
dayOfMonth :: Maybe Text
$sel:scheduledAuditName:CreateScheduledAudit' :: CreateScheduledAudit -> Text
$sel:targetCheckNames:CreateScheduledAudit' :: CreateScheduledAudit -> [Text]
$sel:frequency:CreateScheduledAudit' :: CreateScheduledAudit -> AuditFrequency
$sel:tags:CreateScheduledAudit' :: CreateScheduledAudit -> Maybe [Tag]
$sel:dayOfWeek:CreateScheduledAudit' :: CreateScheduledAudit -> Maybe DayOfWeek
$sel:dayOfMonth:CreateScheduledAudit' :: CreateScheduledAudit -> Maybe Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/audit/scheduledaudits/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
scheduledAuditName
      ]

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

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

-- |
-- Create a value of 'CreateScheduledAuditResponse' 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:
--
-- 'scheduledAuditArn', 'createScheduledAuditResponse_scheduledAuditArn' - The ARN of the scheduled audit.
--
-- 'httpStatus', 'createScheduledAuditResponse_httpStatus' - The response's http status code.
newCreateScheduledAuditResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateScheduledAuditResponse
newCreateScheduledAuditResponse :: Int -> CreateScheduledAuditResponse
newCreateScheduledAuditResponse Int
pHttpStatus_ =
  CreateScheduledAuditResponse' :: Maybe Text -> Int -> CreateScheduledAuditResponse
CreateScheduledAuditResponse'
    { $sel:scheduledAuditArn:CreateScheduledAuditResponse' :: Maybe Text
scheduledAuditArn =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateScheduledAuditResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The ARN of the scheduled audit.
createScheduledAuditResponse_scheduledAuditArn :: Lens.Lens' CreateScheduledAuditResponse (Prelude.Maybe Prelude.Text)
createScheduledAuditResponse_scheduledAuditArn :: (Maybe Text -> f (Maybe Text))
-> CreateScheduledAuditResponse -> f CreateScheduledAuditResponse
createScheduledAuditResponse_scheduledAuditArn = (CreateScheduledAuditResponse -> Maybe Text)
-> (CreateScheduledAuditResponse
    -> Maybe Text -> CreateScheduledAuditResponse)
-> Lens
     CreateScheduledAuditResponse
     CreateScheduledAuditResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateScheduledAuditResponse' {Maybe Text
scheduledAuditArn :: Maybe Text
$sel:scheduledAuditArn:CreateScheduledAuditResponse' :: CreateScheduledAuditResponse -> Maybe Text
scheduledAuditArn} -> Maybe Text
scheduledAuditArn) (\s :: CreateScheduledAuditResponse
s@CreateScheduledAuditResponse' {} Maybe Text
a -> CreateScheduledAuditResponse
s {$sel:scheduledAuditArn:CreateScheduledAuditResponse' :: Maybe Text
scheduledAuditArn = Maybe Text
a} :: CreateScheduledAuditResponse)

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

instance Prelude.NFData CreateScheduledAuditResponse