{-# 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.QuickSight.CreateAnalysis
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates an analysis in Amazon QuickSight.
module Amazonka.QuickSight.CreateAnalysis
  ( -- * Creating a Request
    CreateAnalysis (..),
    newCreateAnalysis,

    -- * Request Lenses
    createAnalysis_definition,
    createAnalysis_parameters,
    createAnalysis_permissions,
    createAnalysis_sourceEntity,
    createAnalysis_tags,
    createAnalysis_themeArn,
    createAnalysis_awsAccountId,
    createAnalysis_analysisId,
    createAnalysis_name,

    -- * Destructuring the Response
    CreateAnalysisResponse (..),
    newCreateAnalysisResponse,

    -- * Response Lenses
    createAnalysisResponse_analysisId,
    createAnalysisResponse_arn,
    createAnalysisResponse_creationStatus,
    createAnalysisResponse_requestId,
    createAnalysisResponse_status,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import Amazonka.QuickSight.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newCreateAnalysis' smart constructor.
data CreateAnalysis = CreateAnalysis'
  { -- | The definition of an analysis.
    --
    -- A definition is the data model of all features in a Dashboard, Template,
    -- or Analysis.
    CreateAnalysis -> Maybe AnalysisDefinition
definition :: Prelude.Maybe AnalysisDefinition,
    -- | The parameter names and override values that you want to use. An
    -- analysis can have any parameter type, and some parameters might accept
    -- multiple values.
    CreateAnalysis -> Maybe Parameters
parameters :: Prelude.Maybe Parameters,
    -- | A structure that describes the principals and the resource-level
    -- permissions on an analysis. You can use the @Permissions@ structure to
    -- grant permissions by providing a list of Identity and Access Management
    -- (IAM) action information for each principal listed by Amazon Resource
    -- Name (ARN).
    --
    -- To specify no permissions, omit @Permissions@.
    CreateAnalysis -> Maybe (NonEmpty ResourcePermission)
permissions :: Prelude.Maybe (Prelude.NonEmpty ResourcePermission),
    -- | A source entity to use for the analysis that you\'re creating. This
    -- metadata structure contains details that describe a source template and
    -- one or more datasets.
    CreateAnalysis -> Maybe AnalysisSourceEntity
sourceEntity :: Prelude.Maybe AnalysisSourceEntity,
    -- | Contains a map of the key-value pairs for the resource tag or tags
    -- assigned to the analysis.
    CreateAnalysis -> Maybe (NonEmpty Tag)
tags :: Prelude.Maybe (Prelude.NonEmpty Tag),
    -- | The ARN for the theme to apply to the analysis that you\'re creating. To
    -- see the theme in the Amazon QuickSight console, make sure that you have
    -- access to it.
    CreateAnalysis -> Maybe Text
themeArn :: Prelude.Maybe Prelude.Text,
    -- | The ID of the Amazon Web Services account where you are creating an
    -- analysis.
    CreateAnalysis -> Text
awsAccountId :: Prelude.Text,
    -- | The ID for the analysis that you\'re creating. This ID displays in the
    -- URL of the analysis.
    CreateAnalysis -> Text
analysisId :: Prelude.Text,
    -- | A descriptive name for the analysis that you\'re creating. This name
    -- displays for the analysis in the Amazon QuickSight console.
    CreateAnalysis -> Text
name :: Prelude.Text
  }
  deriving (CreateAnalysis -> CreateAnalysis -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateAnalysis -> CreateAnalysis -> Bool
$c/= :: CreateAnalysis -> CreateAnalysis -> Bool
== :: CreateAnalysis -> CreateAnalysis -> Bool
$c== :: CreateAnalysis -> CreateAnalysis -> Bool
Prelude.Eq, Int -> CreateAnalysis -> ShowS
[CreateAnalysis] -> ShowS
CreateAnalysis -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateAnalysis] -> ShowS
$cshowList :: [CreateAnalysis] -> ShowS
show :: CreateAnalysis -> String
$cshow :: CreateAnalysis -> String
showsPrec :: Int -> CreateAnalysis -> ShowS
$cshowsPrec :: Int -> CreateAnalysis -> ShowS
Prelude.Show, forall x. Rep CreateAnalysis x -> CreateAnalysis
forall x. CreateAnalysis -> Rep CreateAnalysis x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateAnalysis x -> CreateAnalysis
$cfrom :: forall x. CreateAnalysis -> Rep CreateAnalysis x
Prelude.Generic)

-- |
-- Create a value of 'CreateAnalysis' 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:
--
-- 'definition', 'createAnalysis_definition' - The definition of an analysis.
--
-- A definition is the data model of all features in a Dashboard, Template,
-- or Analysis.
--
-- 'parameters', 'createAnalysis_parameters' - The parameter names and override values that you want to use. An
-- analysis can have any parameter type, and some parameters might accept
-- multiple values.
--
-- 'permissions', 'createAnalysis_permissions' - A structure that describes the principals and the resource-level
-- permissions on an analysis. You can use the @Permissions@ structure to
-- grant permissions by providing a list of Identity and Access Management
-- (IAM) action information for each principal listed by Amazon Resource
-- Name (ARN).
--
-- To specify no permissions, omit @Permissions@.
--
-- 'sourceEntity', 'createAnalysis_sourceEntity' - A source entity to use for the analysis that you\'re creating. This
-- metadata structure contains details that describe a source template and
-- one or more datasets.
--
-- 'tags', 'createAnalysis_tags' - Contains a map of the key-value pairs for the resource tag or tags
-- assigned to the analysis.
--
-- 'themeArn', 'createAnalysis_themeArn' - The ARN for the theme to apply to the analysis that you\'re creating. To
-- see the theme in the Amazon QuickSight console, make sure that you have
-- access to it.
--
-- 'awsAccountId', 'createAnalysis_awsAccountId' - The ID of the Amazon Web Services account where you are creating an
-- analysis.
--
-- 'analysisId', 'createAnalysis_analysisId' - The ID for the analysis that you\'re creating. This ID displays in the
-- URL of the analysis.
--
-- 'name', 'createAnalysis_name' - A descriptive name for the analysis that you\'re creating. This name
-- displays for the analysis in the Amazon QuickSight console.
newCreateAnalysis ::
  -- | 'awsAccountId'
  Prelude.Text ->
  -- | 'analysisId'
  Prelude.Text ->
  -- | 'name'
  Prelude.Text ->
  CreateAnalysis
newCreateAnalysis :: Text -> Text -> Text -> CreateAnalysis
newCreateAnalysis Text
pAwsAccountId_ Text
pAnalysisId_ Text
pName_ =
  CreateAnalysis'
    { $sel:definition:CreateAnalysis' :: Maybe AnalysisDefinition
definition = forall a. Maybe a
Prelude.Nothing,
      $sel:parameters:CreateAnalysis' :: Maybe Parameters
parameters = forall a. Maybe a
Prelude.Nothing,
      $sel:permissions:CreateAnalysis' :: Maybe (NonEmpty ResourcePermission)
permissions = forall a. Maybe a
Prelude.Nothing,
      $sel:sourceEntity:CreateAnalysis' :: Maybe AnalysisSourceEntity
sourceEntity = forall a. Maybe a
Prelude.Nothing,
      $sel:tags:CreateAnalysis' :: Maybe (NonEmpty Tag)
tags = forall a. Maybe a
Prelude.Nothing,
      $sel:themeArn:CreateAnalysis' :: Maybe Text
themeArn = forall a. Maybe a
Prelude.Nothing,
      $sel:awsAccountId:CreateAnalysis' :: Text
awsAccountId = Text
pAwsAccountId_,
      $sel:analysisId:CreateAnalysis' :: Text
analysisId = Text
pAnalysisId_,
      $sel:name:CreateAnalysis' :: Text
name = Text
pName_
    }

-- | The definition of an analysis.
--
-- A definition is the data model of all features in a Dashboard, Template,
-- or Analysis.
createAnalysis_definition :: Lens.Lens' CreateAnalysis (Prelude.Maybe AnalysisDefinition)
createAnalysis_definition :: Lens' CreateAnalysis (Maybe AnalysisDefinition)
createAnalysis_definition = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAnalysis' {Maybe AnalysisDefinition
definition :: Maybe AnalysisDefinition
$sel:definition:CreateAnalysis' :: CreateAnalysis -> Maybe AnalysisDefinition
definition} -> Maybe AnalysisDefinition
definition) (\s :: CreateAnalysis
s@CreateAnalysis' {} Maybe AnalysisDefinition
a -> CreateAnalysis
s {$sel:definition:CreateAnalysis' :: Maybe AnalysisDefinition
definition = Maybe AnalysisDefinition
a} :: CreateAnalysis)

-- | The parameter names and override values that you want to use. An
-- analysis can have any parameter type, and some parameters might accept
-- multiple values.
createAnalysis_parameters :: Lens.Lens' CreateAnalysis (Prelude.Maybe Parameters)
createAnalysis_parameters :: Lens' CreateAnalysis (Maybe Parameters)
createAnalysis_parameters = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAnalysis' {Maybe Parameters
parameters :: Maybe Parameters
$sel:parameters:CreateAnalysis' :: CreateAnalysis -> Maybe Parameters
parameters} -> Maybe Parameters
parameters) (\s :: CreateAnalysis
s@CreateAnalysis' {} Maybe Parameters
a -> CreateAnalysis
s {$sel:parameters:CreateAnalysis' :: Maybe Parameters
parameters = Maybe Parameters
a} :: CreateAnalysis)

-- | A structure that describes the principals and the resource-level
-- permissions on an analysis. You can use the @Permissions@ structure to
-- grant permissions by providing a list of Identity and Access Management
-- (IAM) action information for each principal listed by Amazon Resource
-- Name (ARN).
--
-- To specify no permissions, omit @Permissions@.
createAnalysis_permissions :: Lens.Lens' CreateAnalysis (Prelude.Maybe (Prelude.NonEmpty ResourcePermission))
createAnalysis_permissions :: Lens' CreateAnalysis (Maybe (NonEmpty ResourcePermission))
createAnalysis_permissions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAnalysis' {Maybe (NonEmpty ResourcePermission)
permissions :: Maybe (NonEmpty ResourcePermission)
$sel:permissions:CreateAnalysis' :: CreateAnalysis -> Maybe (NonEmpty ResourcePermission)
permissions} -> Maybe (NonEmpty ResourcePermission)
permissions) (\s :: CreateAnalysis
s@CreateAnalysis' {} Maybe (NonEmpty ResourcePermission)
a -> CreateAnalysis
s {$sel:permissions:CreateAnalysis' :: Maybe (NonEmpty ResourcePermission)
permissions = Maybe (NonEmpty ResourcePermission)
a} :: CreateAnalysis) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A source entity to use for the analysis that you\'re creating. This
-- metadata structure contains details that describe a source template and
-- one or more datasets.
createAnalysis_sourceEntity :: Lens.Lens' CreateAnalysis (Prelude.Maybe AnalysisSourceEntity)
createAnalysis_sourceEntity :: Lens' CreateAnalysis (Maybe AnalysisSourceEntity)
createAnalysis_sourceEntity = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAnalysis' {Maybe AnalysisSourceEntity
sourceEntity :: Maybe AnalysisSourceEntity
$sel:sourceEntity:CreateAnalysis' :: CreateAnalysis -> Maybe AnalysisSourceEntity
sourceEntity} -> Maybe AnalysisSourceEntity
sourceEntity) (\s :: CreateAnalysis
s@CreateAnalysis' {} Maybe AnalysisSourceEntity
a -> CreateAnalysis
s {$sel:sourceEntity:CreateAnalysis' :: Maybe AnalysisSourceEntity
sourceEntity = Maybe AnalysisSourceEntity
a} :: CreateAnalysis)

-- | Contains a map of the key-value pairs for the resource tag or tags
-- assigned to the analysis.
createAnalysis_tags :: Lens.Lens' CreateAnalysis (Prelude.Maybe (Prelude.NonEmpty Tag))
createAnalysis_tags :: Lens' CreateAnalysis (Maybe (NonEmpty Tag))
createAnalysis_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAnalysis' {Maybe (NonEmpty Tag)
tags :: Maybe (NonEmpty Tag)
$sel:tags:CreateAnalysis' :: CreateAnalysis -> Maybe (NonEmpty Tag)
tags} -> Maybe (NonEmpty Tag)
tags) (\s :: CreateAnalysis
s@CreateAnalysis' {} Maybe (NonEmpty Tag)
a -> CreateAnalysis
s {$sel:tags:CreateAnalysis' :: Maybe (NonEmpty Tag)
tags = Maybe (NonEmpty Tag)
a} :: CreateAnalysis) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The ARN for the theme to apply to the analysis that you\'re creating. To
-- see the theme in the Amazon QuickSight console, make sure that you have
-- access to it.
createAnalysis_themeArn :: Lens.Lens' CreateAnalysis (Prelude.Maybe Prelude.Text)
createAnalysis_themeArn :: Lens' CreateAnalysis (Maybe Text)
createAnalysis_themeArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAnalysis' {Maybe Text
themeArn :: Maybe Text
$sel:themeArn:CreateAnalysis' :: CreateAnalysis -> Maybe Text
themeArn} -> Maybe Text
themeArn) (\s :: CreateAnalysis
s@CreateAnalysis' {} Maybe Text
a -> CreateAnalysis
s {$sel:themeArn:CreateAnalysis' :: Maybe Text
themeArn = Maybe Text
a} :: CreateAnalysis)

-- | The ID of the Amazon Web Services account where you are creating an
-- analysis.
createAnalysis_awsAccountId :: Lens.Lens' CreateAnalysis Prelude.Text
createAnalysis_awsAccountId :: Lens' CreateAnalysis Text
createAnalysis_awsAccountId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAnalysis' {Text
awsAccountId :: Text
$sel:awsAccountId:CreateAnalysis' :: CreateAnalysis -> Text
awsAccountId} -> Text
awsAccountId) (\s :: CreateAnalysis
s@CreateAnalysis' {} Text
a -> CreateAnalysis
s {$sel:awsAccountId:CreateAnalysis' :: Text
awsAccountId = Text
a} :: CreateAnalysis)

-- | The ID for the analysis that you\'re creating. This ID displays in the
-- URL of the analysis.
createAnalysis_analysisId :: Lens.Lens' CreateAnalysis Prelude.Text
createAnalysis_analysisId :: Lens' CreateAnalysis Text
createAnalysis_analysisId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAnalysis' {Text
analysisId :: Text
$sel:analysisId:CreateAnalysis' :: CreateAnalysis -> Text
analysisId} -> Text
analysisId) (\s :: CreateAnalysis
s@CreateAnalysis' {} Text
a -> CreateAnalysis
s {$sel:analysisId:CreateAnalysis' :: Text
analysisId = Text
a} :: CreateAnalysis)

-- | A descriptive name for the analysis that you\'re creating. This name
-- displays for the analysis in the Amazon QuickSight console.
createAnalysis_name :: Lens.Lens' CreateAnalysis Prelude.Text
createAnalysis_name :: Lens' CreateAnalysis Text
createAnalysis_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAnalysis' {Text
name :: Text
$sel:name:CreateAnalysis' :: CreateAnalysis -> Text
name} -> Text
name) (\s :: CreateAnalysis
s@CreateAnalysis' {} Text
a -> CreateAnalysis
s {$sel:name:CreateAnalysis' :: Text
name = Text
a} :: CreateAnalysis)

instance Core.AWSRequest CreateAnalysis where
  type
    AWSResponse CreateAnalysis =
      CreateAnalysisResponse
  request :: (Service -> Service) -> CreateAnalysis -> Request CreateAnalysis
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateAnalysis
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateAnalysis)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe ResourceStatus
-> Maybe Text
-> Int
-> CreateAnalysisResponse
CreateAnalysisResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"AnalysisId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Arn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"CreationStatus")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"RequestId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable CreateAnalysis where
  hashWithSalt :: Int -> CreateAnalysis -> Int
hashWithSalt Int
_salt CreateAnalysis' {Maybe (NonEmpty ResourcePermission)
Maybe (NonEmpty Tag)
Maybe Text
Maybe AnalysisSourceEntity
Maybe Parameters
Maybe AnalysisDefinition
Text
name :: Text
analysisId :: Text
awsAccountId :: Text
themeArn :: Maybe Text
tags :: Maybe (NonEmpty Tag)
sourceEntity :: Maybe AnalysisSourceEntity
permissions :: Maybe (NonEmpty ResourcePermission)
parameters :: Maybe Parameters
definition :: Maybe AnalysisDefinition
$sel:name:CreateAnalysis' :: CreateAnalysis -> Text
$sel:analysisId:CreateAnalysis' :: CreateAnalysis -> Text
$sel:awsAccountId:CreateAnalysis' :: CreateAnalysis -> Text
$sel:themeArn:CreateAnalysis' :: CreateAnalysis -> Maybe Text
$sel:tags:CreateAnalysis' :: CreateAnalysis -> Maybe (NonEmpty Tag)
$sel:sourceEntity:CreateAnalysis' :: CreateAnalysis -> Maybe AnalysisSourceEntity
$sel:permissions:CreateAnalysis' :: CreateAnalysis -> Maybe (NonEmpty ResourcePermission)
$sel:parameters:CreateAnalysis' :: CreateAnalysis -> Maybe Parameters
$sel:definition:CreateAnalysis' :: CreateAnalysis -> Maybe AnalysisDefinition
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AnalysisDefinition
definition
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Parameters
parameters
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty ResourcePermission)
permissions
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AnalysisSourceEntity
sourceEntity
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty Tag)
tags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
themeArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
awsAccountId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
analysisId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name

instance Prelude.NFData CreateAnalysis where
  rnf :: CreateAnalysis -> ()
rnf CreateAnalysis' {Maybe (NonEmpty ResourcePermission)
Maybe (NonEmpty Tag)
Maybe Text
Maybe AnalysisSourceEntity
Maybe Parameters
Maybe AnalysisDefinition
Text
name :: Text
analysisId :: Text
awsAccountId :: Text
themeArn :: Maybe Text
tags :: Maybe (NonEmpty Tag)
sourceEntity :: Maybe AnalysisSourceEntity
permissions :: Maybe (NonEmpty ResourcePermission)
parameters :: Maybe Parameters
definition :: Maybe AnalysisDefinition
$sel:name:CreateAnalysis' :: CreateAnalysis -> Text
$sel:analysisId:CreateAnalysis' :: CreateAnalysis -> Text
$sel:awsAccountId:CreateAnalysis' :: CreateAnalysis -> Text
$sel:themeArn:CreateAnalysis' :: CreateAnalysis -> Maybe Text
$sel:tags:CreateAnalysis' :: CreateAnalysis -> Maybe (NonEmpty Tag)
$sel:sourceEntity:CreateAnalysis' :: CreateAnalysis -> Maybe AnalysisSourceEntity
$sel:permissions:CreateAnalysis' :: CreateAnalysis -> Maybe (NonEmpty ResourcePermission)
$sel:parameters:CreateAnalysis' :: CreateAnalysis -> Maybe Parameters
$sel:definition:CreateAnalysis' :: CreateAnalysis -> Maybe AnalysisDefinition
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe AnalysisDefinition
definition
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Parameters
parameters
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty ResourcePermission)
permissions
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe AnalysisSourceEntity
sourceEntity
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty Tag)
tags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
themeArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
awsAccountId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
analysisId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name

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

instance Data.ToJSON CreateAnalysis where
  toJSON :: CreateAnalysis -> Value
toJSON CreateAnalysis' {Maybe (NonEmpty ResourcePermission)
Maybe (NonEmpty Tag)
Maybe Text
Maybe AnalysisSourceEntity
Maybe Parameters
Maybe AnalysisDefinition
Text
name :: Text
analysisId :: Text
awsAccountId :: Text
themeArn :: Maybe Text
tags :: Maybe (NonEmpty Tag)
sourceEntity :: Maybe AnalysisSourceEntity
permissions :: Maybe (NonEmpty ResourcePermission)
parameters :: Maybe Parameters
definition :: Maybe AnalysisDefinition
$sel:name:CreateAnalysis' :: CreateAnalysis -> Text
$sel:analysisId:CreateAnalysis' :: CreateAnalysis -> Text
$sel:awsAccountId:CreateAnalysis' :: CreateAnalysis -> Text
$sel:themeArn:CreateAnalysis' :: CreateAnalysis -> Maybe Text
$sel:tags:CreateAnalysis' :: CreateAnalysis -> Maybe (NonEmpty Tag)
$sel:sourceEntity:CreateAnalysis' :: CreateAnalysis -> Maybe AnalysisSourceEntity
$sel:permissions:CreateAnalysis' :: CreateAnalysis -> Maybe (NonEmpty ResourcePermission)
$sel:parameters:CreateAnalysis' :: CreateAnalysis -> Maybe Parameters
$sel:definition:CreateAnalysis' :: CreateAnalysis -> Maybe AnalysisDefinition
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"Definition" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AnalysisDefinition
definition,
            (Key
"Parameters" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Parameters
parameters,
            (Key
"Permissions" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty ResourcePermission)
permissions,
            (Key
"SourceEntity" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AnalysisSourceEntity
sourceEntity,
            (Key
"Tags" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Tag)
tags,
            (Key
"ThemeArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
themeArn,
            forall a. a -> Maybe a
Prelude.Just (Key
"Name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name)
          ]
      )

instance Data.ToPath CreateAnalysis where
  toPath :: CreateAnalysis -> ByteString
toPath CreateAnalysis' {Maybe (NonEmpty ResourcePermission)
Maybe (NonEmpty Tag)
Maybe Text
Maybe AnalysisSourceEntity
Maybe Parameters
Maybe AnalysisDefinition
Text
name :: Text
analysisId :: Text
awsAccountId :: Text
themeArn :: Maybe Text
tags :: Maybe (NonEmpty Tag)
sourceEntity :: Maybe AnalysisSourceEntity
permissions :: Maybe (NonEmpty ResourcePermission)
parameters :: Maybe Parameters
definition :: Maybe AnalysisDefinition
$sel:name:CreateAnalysis' :: CreateAnalysis -> Text
$sel:analysisId:CreateAnalysis' :: CreateAnalysis -> Text
$sel:awsAccountId:CreateAnalysis' :: CreateAnalysis -> Text
$sel:themeArn:CreateAnalysis' :: CreateAnalysis -> Maybe Text
$sel:tags:CreateAnalysis' :: CreateAnalysis -> Maybe (NonEmpty Tag)
$sel:sourceEntity:CreateAnalysis' :: CreateAnalysis -> Maybe AnalysisSourceEntity
$sel:permissions:CreateAnalysis' :: CreateAnalysis -> Maybe (NonEmpty ResourcePermission)
$sel:parameters:CreateAnalysis' :: CreateAnalysis -> Maybe Parameters
$sel:definition:CreateAnalysis' :: CreateAnalysis -> Maybe AnalysisDefinition
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/accounts/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
awsAccountId,
        ByteString
"/analyses/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
analysisId
      ]

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

-- | /See:/ 'newCreateAnalysisResponse' smart constructor.
data CreateAnalysisResponse = CreateAnalysisResponse'
  { -- | The ID of the analysis.
    CreateAnalysisResponse -> Maybe Text
analysisId :: Prelude.Maybe Prelude.Text,
    -- | The ARN for the analysis.
    CreateAnalysisResponse -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The status of the creation of the analysis.
    CreateAnalysisResponse -> Maybe ResourceStatus
creationStatus :: Prelude.Maybe ResourceStatus,
    -- | The Amazon Web Services request ID for this operation.
    CreateAnalysisResponse -> Maybe Text
requestId :: Prelude.Maybe Prelude.Text,
    -- | The HTTP status of the request.
    CreateAnalysisResponse -> Int
status :: Prelude.Int
  }
  deriving (CreateAnalysisResponse -> CreateAnalysisResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateAnalysisResponse -> CreateAnalysisResponse -> Bool
$c/= :: CreateAnalysisResponse -> CreateAnalysisResponse -> Bool
== :: CreateAnalysisResponse -> CreateAnalysisResponse -> Bool
$c== :: CreateAnalysisResponse -> CreateAnalysisResponse -> Bool
Prelude.Eq, ReadPrec [CreateAnalysisResponse]
ReadPrec CreateAnalysisResponse
Int -> ReadS CreateAnalysisResponse
ReadS [CreateAnalysisResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateAnalysisResponse]
$creadListPrec :: ReadPrec [CreateAnalysisResponse]
readPrec :: ReadPrec CreateAnalysisResponse
$creadPrec :: ReadPrec CreateAnalysisResponse
readList :: ReadS [CreateAnalysisResponse]
$creadList :: ReadS [CreateAnalysisResponse]
readsPrec :: Int -> ReadS CreateAnalysisResponse
$creadsPrec :: Int -> ReadS CreateAnalysisResponse
Prelude.Read, Int -> CreateAnalysisResponse -> ShowS
[CreateAnalysisResponse] -> ShowS
CreateAnalysisResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateAnalysisResponse] -> ShowS
$cshowList :: [CreateAnalysisResponse] -> ShowS
show :: CreateAnalysisResponse -> String
$cshow :: CreateAnalysisResponse -> String
showsPrec :: Int -> CreateAnalysisResponse -> ShowS
$cshowsPrec :: Int -> CreateAnalysisResponse -> ShowS
Prelude.Show, forall x. Rep CreateAnalysisResponse x -> CreateAnalysisResponse
forall x. CreateAnalysisResponse -> Rep CreateAnalysisResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateAnalysisResponse x -> CreateAnalysisResponse
$cfrom :: forall x. CreateAnalysisResponse -> Rep CreateAnalysisResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateAnalysisResponse' 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:
--
-- 'analysisId', 'createAnalysisResponse_analysisId' - The ID of the analysis.
--
-- 'arn', 'createAnalysisResponse_arn' - The ARN for the analysis.
--
-- 'creationStatus', 'createAnalysisResponse_creationStatus' - The status of the creation of the analysis.
--
-- 'requestId', 'createAnalysisResponse_requestId' - The Amazon Web Services request ID for this operation.
--
-- 'status', 'createAnalysisResponse_status' - The HTTP status of the request.
newCreateAnalysisResponse ::
  -- | 'status'
  Prelude.Int ->
  CreateAnalysisResponse
newCreateAnalysisResponse :: Int -> CreateAnalysisResponse
newCreateAnalysisResponse Int
pStatus_ =
  CreateAnalysisResponse'
    { $sel:analysisId:CreateAnalysisResponse' :: Maybe Text
analysisId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:arn:CreateAnalysisResponse' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:creationStatus:CreateAnalysisResponse' :: Maybe ResourceStatus
creationStatus = forall a. Maybe a
Prelude.Nothing,
      $sel:requestId:CreateAnalysisResponse' :: Maybe Text
requestId = forall a. Maybe a
Prelude.Nothing,
      $sel:status:CreateAnalysisResponse' :: Int
status = Int
pStatus_
    }

-- | The ID of the analysis.
createAnalysisResponse_analysisId :: Lens.Lens' CreateAnalysisResponse (Prelude.Maybe Prelude.Text)
createAnalysisResponse_analysisId :: Lens' CreateAnalysisResponse (Maybe Text)
createAnalysisResponse_analysisId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAnalysisResponse' {Maybe Text
analysisId :: Maybe Text
$sel:analysisId:CreateAnalysisResponse' :: CreateAnalysisResponse -> Maybe Text
analysisId} -> Maybe Text
analysisId) (\s :: CreateAnalysisResponse
s@CreateAnalysisResponse' {} Maybe Text
a -> CreateAnalysisResponse
s {$sel:analysisId:CreateAnalysisResponse' :: Maybe Text
analysisId = Maybe Text
a} :: CreateAnalysisResponse)

-- | The ARN for the analysis.
createAnalysisResponse_arn :: Lens.Lens' CreateAnalysisResponse (Prelude.Maybe Prelude.Text)
createAnalysisResponse_arn :: Lens' CreateAnalysisResponse (Maybe Text)
createAnalysisResponse_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAnalysisResponse' {Maybe Text
arn :: Maybe Text
$sel:arn:CreateAnalysisResponse' :: CreateAnalysisResponse -> Maybe Text
arn} -> Maybe Text
arn) (\s :: CreateAnalysisResponse
s@CreateAnalysisResponse' {} Maybe Text
a -> CreateAnalysisResponse
s {$sel:arn:CreateAnalysisResponse' :: Maybe Text
arn = Maybe Text
a} :: CreateAnalysisResponse)

-- | The status of the creation of the analysis.
createAnalysisResponse_creationStatus :: Lens.Lens' CreateAnalysisResponse (Prelude.Maybe ResourceStatus)
createAnalysisResponse_creationStatus :: Lens' CreateAnalysisResponse (Maybe ResourceStatus)
createAnalysisResponse_creationStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAnalysisResponse' {Maybe ResourceStatus
creationStatus :: Maybe ResourceStatus
$sel:creationStatus:CreateAnalysisResponse' :: CreateAnalysisResponse -> Maybe ResourceStatus
creationStatus} -> Maybe ResourceStatus
creationStatus) (\s :: CreateAnalysisResponse
s@CreateAnalysisResponse' {} Maybe ResourceStatus
a -> CreateAnalysisResponse
s {$sel:creationStatus:CreateAnalysisResponse' :: Maybe ResourceStatus
creationStatus = Maybe ResourceStatus
a} :: CreateAnalysisResponse)

-- | The Amazon Web Services request ID for this operation.
createAnalysisResponse_requestId :: Lens.Lens' CreateAnalysisResponse (Prelude.Maybe Prelude.Text)
createAnalysisResponse_requestId :: Lens' CreateAnalysisResponse (Maybe Text)
createAnalysisResponse_requestId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAnalysisResponse' {Maybe Text
requestId :: Maybe Text
$sel:requestId:CreateAnalysisResponse' :: CreateAnalysisResponse -> Maybe Text
requestId} -> Maybe Text
requestId) (\s :: CreateAnalysisResponse
s@CreateAnalysisResponse' {} Maybe Text
a -> CreateAnalysisResponse
s {$sel:requestId:CreateAnalysisResponse' :: Maybe Text
requestId = Maybe Text
a} :: CreateAnalysisResponse)

-- | The HTTP status of the request.
createAnalysisResponse_status :: Lens.Lens' CreateAnalysisResponse Prelude.Int
createAnalysisResponse_status :: Lens' CreateAnalysisResponse Int
createAnalysisResponse_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAnalysisResponse' {Int
status :: Int
$sel:status:CreateAnalysisResponse' :: CreateAnalysisResponse -> Int
status} -> Int
status) (\s :: CreateAnalysisResponse
s@CreateAnalysisResponse' {} Int
a -> CreateAnalysisResponse
s {$sel:status:CreateAnalysisResponse' :: Int
status = Int
a} :: CreateAnalysisResponse)

instance Prelude.NFData CreateAnalysisResponse where
  rnf :: CreateAnalysisResponse -> ()
rnf CreateAnalysisResponse' {Int
Maybe Text
Maybe ResourceStatus
status :: Int
requestId :: Maybe Text
creationStatus :: Maybe ResourceStatus
arn :: Maybe Text
analysisId :: Maybe Text
$sel:status:CreateAnalysisResponse' :: CreateAnalysisResponse -> Int
$sel:requestId:CreateAnalysisResponse' :: CreateAnalysisResponse -> Maybe Text
$sel:creationStatus:CreateAnalysisResponse' :: CreateAnalysisResponse -> Maybe ResourceStatus
$sel:arn:CreateAnalysisResponse' :: CreateAnalysisResponse -> Maybe Text
$sel:analysisId:CreateAnalysisResponse' :: CreateAnalysisResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
analysisId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ResourceStatus
creationStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
requestId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
status