{-# 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.AlexaBusiness.CreateBusinessReportSchedule
-- 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 recurring schedule for usage reports to deliver to the
-- specified S3 location with a specified daily or weekly interval.
module Amazonka.AlexaBusiness.CreateBusinessReportSchedule
  ( -- * Creating a Request
    CreateBusinessReportSchedule (..),
    newCreateBusinessReportSchedule,

    -- * Request Lenses
    createBusinessReportSchedule_s3KeyPrefix,
    createBusinessReportSchedule_recurrence,
    createBusinessReportSchedule_scheduleName,
    createBusinessReportSchedule_clientRequestToken,
    createBusinessReportSchedule_s3BucketName,
    createBusinessReportSchedule_tags,
    createBusinessReportSchedule_format,
    createBusinessReportSchedule_contentRange,

    -- * Destructuring the Response
    CreateBusinessReportScheduleResponse (..),
    newCreateBusinessReportScheduleResponse,

    -- * Response Lenses
    createBusinessReportScheduleResponse_scheduleArn,
    createBusinessReportScheduleResponse_httpStatus,
  )
where

import Amazonka.AlexaBusiness.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:/ 'newCreateBusinessReportSchedule' smart constructor.
data CreateBusinessReportSchedule = CreateBusinessReportSchedule'
  { -- | The S3 key where the report is delivered.
    CreateBusinessReportSchedule -> Maybe Text
s3KeyPrefix :: Prelude.Maybe Prelude.Text,
    -- | The recurrence of the reports. If this isn\'t specified, the report will
    -- only be delivered one time when the API is called.
    CreateBusinessReportSchedule -> Maybe BusinessReportRecurrence
recurrence :: Prelude.Maybe BusinessReportRecurrence,
    -- | The name identifier of the schedule.
    CreateBusinessReportSchedule -> Maybe Text
scheduleName :: Prelude.Maybe Prelude.Text,
    -- | The client request token.
    CreateBusinessReportSchedule -> Maybe Text
clientRequestToken :: Prelude.Maybe Prelude.Text,
    -- | The S3 bucket name of the output reports. If this isn\'t specified, the
    -- report can be retrieved from a download link by calling
    -- ListBusinessReportSchedule.
    CreateBusinessReportSchedule -> Maybe Text
s3BucketName :: Prelude.Maybe Prelude.Text,
    -- | The tags for the business report schedule.
    CreateBusinessReportSchedule -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | The format of the generated report (individual CSV files or zipped files
    -- of individual files).
    CreateBusinessReportSchedule -> BusinessReportFormat
format :: BusinessReportFormat,
    -- | The content range of the reports.
    CreateBusinessReportSchedule -> BusinessReportContentRange
contentRange :: BusinessReportContentRange
  }
  deriving (CreateBusinessReportSchedule
-> CreateBusinessReportSchedule -> Bool
(CreateBusinessReportSchedule
 -> CreateBusinessReportSchedule -> Bool)
-> (CreateBusinessReportSchedule
    -> CreateBusinessReportSchedule -> Bool)
-> Eq CreateBusinessReportSchedule
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateBusinessReportSchedule
-> CreateBusinessReportSchedule -> Bool
$c/= :: CreateBusinessReportSchedule
-> CreateBusinessReportSchedule -> Bool
== :: CreateBusinessReportSchedule
-> CreateBusinessReportSchedule -> Bool
$c== :: CreateBusinessReportSchedule
-> CreateBusinessReportSchedule -> Bool
Prelude.Eq, ReadPrec [CreateBusinessReportSchedule]
ReadPrec CreateBusinessReportSchedule
Int -> ReadS CreateBusinessReportSchedule
ReadS [CreateBusinessReportSchedule]
(Int -> ReadS CreateBusinessReportSchedule)
-> ReadS [CreateBusinessReportSchedule]
-> ReadPrec CreateBusinessReportSchedule
-> ReadPrec [CreateBusinessReportSchedule]
-> Read CreateBusinessReportSchedule
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateBusinessReportSchedule]
$creadListPrec :: ReadPrec [CreateBusinessReportSchedule]
readPrec :: ReadPrec CreateBusinessReportSchedule
$creadPrec :: ReadPrec CreateBusinessReportSchedule
readList :: ReadS [CreateBusinessReportSchedule]
$creadList :: ReadS [CreateBusinessReportSchedule]
readsPrec :: Int -> ReadS CreateBusinessReportSchedule
$creadsPrec :: Int -> ReadS CreateBusinessReportSchedule
Prelude.Read, Int -> CreateBusinessReportSchedule -> ShowS
[CreateBusinessReportSchedule] -> ShowS
CreateBusinessReportSchedule -> String
(Int -> CreateBusinessReportSchedule -> ShowS)
-> (CreateBusinessReportSchedule -> String)
-> ([CreateBusinessReportSchedule] -> ShowS)
-> Show CreateBusinessReportSchedule
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateBusinessReportSchedule] -> ShowS
$cshowList :: [CreateBusinessReportSchedule] -> ShowS
show :: CreateBusinessReportSchedule -> String
$cshow :: CreateBusinessReportSchedule -> String
showsPrec :: Int -> CreateBusinessReportSchedule -> ShowS
$cshowsPrec :: Int -> CreateBusinessReportSchedule -> ShowS
Prelude.Show, (forall x.
 CreateBusinessReportSchedule -> Rep CreateBusinessReportSchedule x)
-> (forall x.
    Rep CreateBusinessReportSchedule x -> CreateBusinessReportSchedule)
-> Generic CreateBusinessReportSchedule
forall x.
Rep CreateBusinessReportSchedule x -> CreateBusinessReportSchedule
forall x.
CreateBusinessReportSchedule -> Rep CreateBusinessReportSchedule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateBusinessReportSchedule x -> CreateBusinessReportSchedule
$cfrom :: forall x.
CreateBusinessReportSchedule -> Rep CreateBusinessReportSchedule x
Prelude.Generic)

-- |
-- Create a value of 'CreateBusinessReportSchedule' 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:
--
-- 's3KeyPrefix', 'createBusinessReportSchedule_s3KeyPrefix' - The S3 key where the report is delivered.
--
-- 'recurrence', 'createBusinessReportSchedule_recurrence' - The recurrence of the reports. If this isn\'t specified, the report will
-- only be delivered one time when the API is called.
--
-- 'scheduleName', 'createBusinessReportSchedule_scheduleName' - The name identifier of the schedule.
--
-- 'clientRequestToken', 'createBusinessReportSchedule_clientRequestToken' - The client request token.
--
-- 's3BucketName', 'createBusinessReportSchedule_s3BucketName' - The S3 bucket name of the output reports. If this isn\'t specified, the
-- report can be retrieved from a download link by calling
-- ListBusinessReportSchedule.
--
-- 'tags', 'createBusinessReportSchedule_tags' - The tags for the business report schedule.
--
-- 'format', 'createBusinessReportSchedule_format' - The format of the generated report (individual CSV files or zipped files
-- of individual files).
--
-- 'contentRange', 'createBusinessReportSchedule_contentRange' - The content range of the reports.
newCreateBusinessReportSchedule ::
  -- | 'format'
  BusinessReportFormat ->
  -- | 'contentRange'
  BusinessReportContentRange ->
  CreateBusinessReportSchedule
newCreateBusinessReportSchedule :: BusinessReportFormat
-> BusinessReportContentRange -> CreateBusinessReportSchedule
newCreateBusinessReportSchedule
  BusinessReportFormat
pFormat_
  BusinessReportContentRange
pContentRange_ =
    CreateBusinessReportSchedule' :: Maybe Text
-> Maybe BusinessReportRecurrence
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [Tag]
-> BusinessReportFormat
-> BusinessReportContentRange
-> CreateBusinessReportSchedule
CreateBusinessReportSchedule'
      { $sel:s3KeyPrefix:CreateBusinessReportSchedule' :: Maybe Text
s3KeyPrefix =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:recurrence:CreateBusinessReportSchedule' :: Maybe BusinessReportRecurrence
recurrence = Maybe BusinessReportRecurrence
forall a. Maybe a
Prelude.Nothing,
        $sel:scheduleName:CreateBusinessReportSchedule' :: Maybe Text
scheduleName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:clientRequestToken:CreateBusinessReportSchedule' :: Maybe Text
clientRequestToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:s3BucketName:CreateBusinessReportSchedule' :: Maybe Text
s3BucketName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateBusinessReportSchedule' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
        $sel:format:CreateBusinessReportSchedule' :: BusinessReportFormat
format = BusinessReportFormat
pFormat_,
        $sel:contentRange:CreateBusinessReportSchedule' :: BusinessReportContentRange
contentRange = BusinessReportContentRange
pContentRange_
      }

-- | The S3 key where the report is delivered.
createBusinessReportSchedule_s3KeyPrefix :: Lens.Lens' CreateBusinessReportSchedule (Prelude.Maybe Prelude.Text)
createBusinessReportSchedule_s3KeyPrefix :: (Maybe Text -> f (Maybe Text))
-> CreateBusinessReportSchedule -> f CreateBusinessReportSchedule
createBusinessReportSchedule_s3KeyPrefix = (CreateBusinessReportSchedule -> Maybe Text)
-> (CreateBusinessReportSchedule
    -> Maybe Text -> CreateBusinessReportSchedule)
-> Lens
     CreateBusinessReportSchedule
     CreateBusinessReportSchedule
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBusinessReportSchedule' {Maybe Text
s3KeyPrefix :: Maybe Text
$sel:s3KeyPrefix:CreateBusinessReportSchedule' :: CreateBusinessReportSchedule -> Maybe Text
s3KeyPrefix} -> Maybe Text
s3KeyPrefix) (\s :: CreateBusinessReportSchedule
s@CreateBusinessReportSchedule' {} Maybe Text
a -> CreateBusinessReportSchedule
s {$sel:s3KeyPrefix:CreateBusinessReportSchedule' :: Maybe Text
s3KeyPrefix = Maybe Text
a} :: CreateBusinessReportSchedule)

-- | The recurrence of the reports. If this isn\'t specified, the report will
-- only be delivered one time when the API is called.
createBusinessReportSchedule_recurrence :: Lens.Lens' CreateBusinessReportSchedule (Prelude.Maybe BusinessReportRecurrence)
createBusinessReportSchedule_recurrence :: (Maybe BusinessReportRecurrence
 -> f (Maybe BusinessReportRecurrence))
-> CreateBusinessReportSchedule -> f CreateBusinessReportSchedule
createBusinessReportSchedule_recurrence = (CreateBusinessReportSchedule -> Maybe BusinessReportRecurrence)
-> (CreateBusinessReportSchedule
    -> Maybe BusinessReportRecurrence -> CreateBusinessReportSchedule)
-> Lens
     CreateBusinessReportSchedule
     CreateBusinessReportSchedule
     (Maybe BusinessReportRecurrence)
     (Maybe BusinessReportRecurrence)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBusinessReportSchedule' {Maybe BusinessReportRecurrence
recurrence :: Maybe BusinessReportRecurrence
$sel:recurrence:CreateBusinessReportSchedule' :: CreateBusinessReportSchedule -> Maybe BusinessReportRecurrence
recurrence} -> Maybe BusinessReportRecurrence
recurrence) (\s :: CreateBusinessReportSchedule
s@CreateBusinessReportSchedule' {} Maybe BusinessReportRecurrence
a -> CreateBusinessReportSchedule
s {$sel:recurrence:CreateBusinessReportSchedule' :: Maybe BusinessReportRecurrence
recurrence = Maybe BusinessReportRecurrence
a} :: CreateBusinessReportSchedule)

-- | The name identifier of the schedule.
createBusinessReportSchedule_scheduleName :: Lens.Lens' CreateBusinessReportSchedule (Prelude.Maybe Prelude.Text)
createBusinessReportSchedule_scheduleName :: (Maybe Text -> f (Maybe Text))
-> CreateBusinessReportSchedule -> f CreateBusinessReportSchedule
createBusinessReportSchedule_scheduleName = (CreateBusinessReportSchedule -> Maybe Text)
-> (CreateBusinessReportSchedule
    -> Maybe Text -> CreateBusinessReportSchedule)
-> Lens
     CreateBusinessReportSchedule
     CreateBusinessReportSchedule
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBusinessReportSchedule' {Maybe Text
scheduleName :: Maybe Text
$sel:scheduleName:CreateBusinessReportSchedule' :: CreateBusinessReportSchedule -> Maybe Text
scheduleName} -> Maybe Text
scheduleName) (\s :: CreateBusinessReportSchedule
s@CreateBusinessReportSchedule' {} Maybe Text
a -> CreateBusinessReportSchedule
s {$sel:scheduleName:CreateBusinessReportSchedule' :: Maybe Text
scheduleName = Maybe Text
a} :: CreateBusinessReportSchedule)

-- | The client request token.
createBusinessReportSchedule_clientRequestToken :: Lens.Lens' CreateBusinessReportSchedule (Prelude.Maybe Prelude.Text)
createBusinessReportSchedule_clientRequestToken :: (Maybe Text -> f (Maybe Text))
-> CreateBusinessReportSchedule -> f CreateBusinessReportSchedule
createBusinessReportSchedule_clientRequestToken = (CreateBusinessReportSchedule -> Maybe Text)
-> (CreateBusinessReportSchedule
    -> Maybe Text -> CreateBusinessReportSchedule)
-> Lens
     CreateBusinessReportSchedule
     CreateBusinessReportSchedule
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBusinessReportSchedule' {Maybe Text
clientRequestToken :: Maybe Text
$sel:clientRequestToken:CreateBusinessReportSchedule' :: CreateBusinessReportSchedule -> Maybe Text
clientRequestToken} -> Maybe Text
clientRequestToken) (\s :: CreateBusinessReportSchedule
s@CreateBusinessReportSchedule' {} Maybe Text
a -> CreateBusinessReportSchedule
s {$sel:clientRequestToken:CreateBusinessReportSchedule' :: Maybe Text
clientRequestToken = Maybe Text
a} :: CreateBusinessReportSchedule)

-- | The S3 bucket name of the output reports. If this isn\'t specified, the
-- report can be retrieved from a download link by calling
-- ListBusinessReportSchedule.
createBusinessReportSchedule_s3BucketName :: Lens.Lens' CreateBusinessReportSchedule (Prelude.Maybe Prelude.Text)
createBusinessReportSchedule_s3BucketName :: (Maybe Text -> f (Maybe Text))
-> CreateBusinessReportSchedule -> f CreateBusinessReportSchedule
createBusinessReportSchedule_s3BucketName = (CreateBusinessReportSchedule -> Maybe Text)
-> (CreateBusinessReportSchedule
    -> Maybe Text -> CreateBusinessReportSchedule)
-> Lens
     CreateBusinessReportSchedule
     CreateBusinessReportSchedule
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBusinessReportSchedule' {Maybe Text
s3BucketName :: Maybe Text
$sel:s3BucketName:CreateBusinessReportSchedule' :: CreateBusinessReportSchedule -> Maybe Text
s3BucketName} -> Maybe Text
s3BucketName) (\s :: CreateBusinessReportSchedule
s@CreateBusinessReportSchedule' {} Maybe Text
a -> CreateBusinessReportSchedule
s {$sel:s3BucketName:CreateBusinessReportSchedule' :: Maybe Text
s3BucketName = Maybe Text
a} :: CreateBusinessReportSchedule)

-- | The tags for the business report schedule.
createBusinessReportSchedule_tags :: Lens.Lens' CreateBusinessReportSchedule (Prelude.Maybe [Tag])
createBusinessReportSchedule_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateBusinessReportSchedule -> f CreateBusinessReportSchedule
createBusinessReportSchedule_tags = (CreateBusinessReportSchedule -> Maybe [Tag])
-> (CreateBusinessReportSchedule
    -> Maybe [Tag] -> CreateBusinessReportSchedule)
-> Lens
     CreateBusinessReportSchedule
     CreateBusinessReportSchedule
     (Maybe [Tag])
     (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBusinessReportSchedule' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateBusinessReportSchedule' :: CreateBusinessReportSchedule -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateBusinessReportSchedule
s@CreateBusinessReportSchedule' {} Maybe [Tag]
a -> CreateBusinessReportSchedule
s {$sel:tags:CreateBusinessReportSchedule' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateBusinessReportSchedule) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> CreateBusinessReportSchedule -> f CreateBusinessReportSchedule)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateBusinessReportSchedule
-> f CreateBusinessReportSchedule
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

-- | The format of the generated report (individual CSV files or zipped files
-- of individual files).
createBusinessReportSchedule_format :: Lens.Lens' CreateBusinessReportSchedule BusinessReportFormat
createBusinessReportSchedule_format :: (BusinessReportFormat -> f BusinessReportFormat)
-> CreateBusinessReportSchedule -> f CreateBusinessReportSchedule
createBusinessReportSchedule_format = (CreateBusinessReportSchedule -> BusinessReportFormat)
-> (CreateBusinessReportSchedule
    -> BusinessReportFormat -> CreateBusinessReportSchedule)
-> Lens
     CreateBusinessReportSchedule
     CreateBusinessReportSchedule
     BusinessReportFormat
     BusinessReportFormat
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBusinessReportSchedule' {BusinessReportFormat
format :: BusinessReportFormat
$sel:format:CreateBusinessReportSchedule' :: CreateBusinessReportSchedule -> BusinessReportFormat
format} -> BusinessReportFormat
format) (\s :: CreateBusinessReportSchedule
s@CreateBusinessReportSchedule' {} BusinessReportFormat
a -> CreateBusinessReportSchedule
s {$sel:format:CreateBusinessReportSchedule' :: BusinessReportFormat
format = BusinessReportFormat
a} :: CreateBusinessReportSchedule)

-- | The content range of the reports.
createBusinessReportSchedule_contentRange :: Lens.Lens' CreateBusinessReportSchedule BusinessReportContentRange
createBusinessReportSchedule_contentRange :: (BusinessReportContentRange -> f BusinessReportContentRange)
-> CreateBusinessReportSchedule -> f CreateBusinessReportSchedule
createBusinessReportSchedule_contentRange = (CreateBusinessReportSchedule -> BusinessReportContentRange)
-> (CreateBusinessReportSchedule
    -> BusinessReportContentRange -> CreateBusinessReportSchedule)
-> Lens
     CreateBusinessReportSchedule
     CreateBusinessReportSchedule
     BusinessReportContentRange
     BusinessReportContentRange
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBusinessReportSchedule' {BusinessReportContentRange
contentRange :: BusinessReportContentRange
$sel:contentRange:CreateBusinessReportSchedule' :: CreateBusinessReportSchedule -> BusinessReportContentRange
contentRange} -> BusinessReportContentRange
contentRange) (\s :: CreateBusinessReportSchedule
s@CreateBusinessReportSchedule' {} BusinessReportContentRange
a -> CreateBusinessReportSchedule
s {$sel:contentRange:CreateBusinessReportSchedule' :: BusinessReportContentRange
contentRange = BusinessReportContentRange
a} :: CreateBusinessReportSchedule)

instance Core.AWSRequest CreateBusinessReportSchedule where
  type
    AWSResponse CreateBusinessReportSchedule =
      CreateBusinessReportScheduleResponse
  request :: CreateBusinessReportSchedule
-> Request CreateBusinessReportSchedule
request = Service
-> CreateBusinessReportSchedule
-> Request CreateBusinessReportSchedule
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateBusinessReportSchedule
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateBusinessReportSchedule)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateBusinessReportSchedule))
-> Logger
-> Service
-> Proxy CreateBusinessReportSchedule
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateBusinessReportSchedule)))
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 -> CreateBusinessReportScheduleResponse
CreateBusinessReportScheduleResponse'
            (Maybe Text -> Int -> CreateBusinessReportScheduleResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateBusinessReportScheduleResponse)
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
"ScheduleArn")
            Either String (Int -> CreateBusinessReportScheduleResponse)
-> Either String Int
-> Either String CreateBusinessReportScheduleResponse
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
    CreateBusinessReportSchedule

instance Prelude.NFData CreateBusinessReportSchedule

instance Core.ToHeaders CreateBusinessReportSchedule where
  toHeaders :: CreateBusinessReportSchedule -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateBusinessReportSchedule -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AlexaForBusiness.CreateBusinessReportSchedule" ::
                          Prelude.ByteString
                      ),
            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 CreateBusinessReportSchedule where
  toJSON :: CreateBusinessReportSchedule -> Value
toJSON CreateBusinessReportSchedule' {Maybe [Tag]
Maybe Text
Maybe BusinessReportRecurrence
BusinessReportFormat
BusinessReportContentRange
contentRange :: BusinessReportContentRange
format :: BusinessReportFormat
tags :: Maybe [Tag]
s3BucketName :: Maybe Text
clientRequestToken :: Maybe Text
scheduleName :: Maybe Text
recurrence :: Maybe BusinessReportRecurrence
s3KeyPrefix :: Maybe Text
$sel:contentRange:CreateBusinessReportSchedule' :: CreateBusinessReportSchedule -> BusinessReportContentRange
$sel:format:CreateBusinessReportSchedule' :: CreateBusinessReportSchedule -> BusinessReportFormat
$sel:tags:CreateBusinessReportSchedule' :: CreateBusinessReportSchedule -> Maybe [Tag]
$sel:s3BucketName:CreateBusinessReportSchedule' :: CreateBusinessReportSchedule -> Maybe Text
$sel:clientRequestToken:CreateBusinessReportSchedule' :: CreateBusinessReportSchedule -> Maybe Text
$sel:scheduleName:CreateBusinessReportSchedule' :: CreateBusinessReportSchedule -> Maybe Text
$sel:recurrence:CreateBusinessReportSchedule' :: CreateBusinessReportSchedule -> Maybe BusinessReportRecurrence
$sel:s3KeyPrefix:CreateBusinessReportSchedule' :: CreateBusinessReportSchedule -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"S3KeyPrefix" 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
s3KeyPrefix,
            (Text
"Recurrence" Text -> BusinessReportRecurrence -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (BusinessReportRecurrence -> Pair)
-> Maybe BusinessReportRecurrence -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe BusinessReportRecurrence
recurrence,
            (Text
"ScheduleName" 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
scheduleName,
            (Text
"ClientRequestToken" 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
clientRequestToken,
            (Text
"S3BucketName" 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
s3BucketName,
            (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
"Format" Text -> BusinessReportFormat -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= BusinessReportFormat
format),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ContentRange" Text -> BusinessReportContentRange -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= BusinessReportContentRange
contentRange)
          ]
      )

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

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

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

-- |
-- Create a value of 'CreateBusinessReportScheduleResponse' 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:
--
-- 'scheduleArn', 'createBusinessReportScheduleResponse_scheduleArn' - The ARN of the business report schedule.
--
-- 'httpStatus', 'createBusinessReportScheduleResponse_httpStatus' - The response's http status code.
newCreateBusinessReportScheduleResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateBusinessReportScheduleResponse
newCreateBusinessReportScheduleResponse :: Int -> CreateBusinessReportScheduleResponse
newCreateBusinessReportScheduleResponse Int
pHttpStatus_ =
  CreateBusinessReportScheduleResponse' :: Maybe Text -> Int -> CreateBusinessReportScheduleResponse
CreateBusinessReportScheduleResponse'
    { $sel:scheduleArn:CreateBusinessReportScheduleResponse' :: Maybe Text
scheduleArn =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateBusinessReportScheduleResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The ARN of the business report schedule.
createBusinessReportScheduleResponse_scheduleArn :: Lens.Lens' CreateBusinessReportScheduleResponse (Prelude.Maybe Prelude.Text)
createBusinessReportScheduleResponse_scheduleArn :: (Maybe Text -> f (Maybe Text))
-> CreateBusinessReportScheduleResponse
-> f CreateBusinessReportScheduleResponse
createBusinessReportScheduleResponse_scheduleArn = (CreateBusinessReportScheduleResponse -> Maybe Text)
-> (CreateBusinessReportScheduleResponse
    -> Maybe Text -> CreateBusinessReportScheduleResponse)
-> Lens
     CreateBusinessReportScheduleResponse
     CreateBusinessReportScheduleResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBusinessReportScheduleResponse' {Maybe Text
scheduleArn :: Maybe Text
$sel:scheduleArn:CreateBusinessReportScheduleResponse' :: CreateBusinessReportScheduleResponse -> Maybe Text
scheduleArn} -> Maybe Text
scheduleArn) (\s :: CreateBusinessReportScheduleResponse
s@CreateBusinessReportScheduleResponse' {} Maybe Text
a -> CreateBusinessReportScheduleResponse
s {$sel:scheduleArn:CreateBusinessReportScheduleResponse' :: Maybe Text
scheduleArn = Maybe Text
a} :: CreateBusinessReportScheduleResponse)

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

instance
  Prelude.NFData
    CreateBusinessReportScheduleResponse