{-# 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.Athena.CreateNamedQuery
-- 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 named query in the specified workgroup. Requires that you have
-- access to the workgroup.
--
-- For code samples using the Amazon Web Services SDK for Java, see
-- <http://docs.aws.amazon.com/athena/latest/ug/code-samples.html Examples and Code Samples>
-- in the /Amazon Athena User Guide/.
module Amazonka.Athena.CreateNamedQuery
  ( -- * Creating a Request
    CreateNamedQuery (..),
    newCreateNamedQuery,

    -- * Request Lenses
    createNamedQuery_clientRequestToken,
    createNamedQuery_description,
    createNamedQuery_workGroup,
    createNamedQuery_name,
    createNamedQuery_database,
    createNamedQuery_queryString,

    -- * Destructuring the Response
    CreateNamedQueryResponse (..),
    newCreateNamedQueryResponse,

    -- * Response Lenses
    createNamedQueryResponse_namedQueryId,
    createNamedQueryResponse_httpStatus,
  )
where

import Amazonka.Athena.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:/ 'newCreateNamedQuery' smart constructor.
data CreateNamedQuery = CreateNamedQuery'
  { -- | A unique case-sensitive string used to ensure the request to create the
    -- query is idempotent (executes only once). If another @CreateNamedQuery@
    -- request is received, the same response is returned and another query is
    -- not created. If a parameter has changed, for example, the @QueryString@,
    -- an error is returned.
    --
    -- This token is listed as not required because Amazon Web Services SDKs
    -- (for example the Amazon Web Services SDK for Java) auto-generate the
    -- token for users. If you are not using the Amazon Web Services SDK or the
    -- Amazon Web Services CLI, you must provide this token or the action will
    -- fail.
    CreateNamedQuery -> Maybe Text
clientRequestToken :: Prelude.Maybe Prelude.Text,
    -- | The query description.
    CreateNamedQuery -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The name of the workgroup in which the named query is being created.
    CreateNamedQuery -> Maybe Text
workGroup :: Prelude.Maybe Prelude.Text,
    -- | The query name.
    CreateNamedQuery -> Text
name :: Prelude.Text,
    -- | The database to which the query belongs.
    CreateNamedQuery -> Text
database :: Prelude.Text,
    -- | The contents of the query with all query statements.
    CreateNamedQuery -> Text
queryString :: Prelude.Text
  }
  deriving (CreateNamedQuery -> CreateNamedQuery -> Bool
(CreateNamedQuery -> CreateNamedQuery -> Bool)
-> (CreateNamedQuery -> CreateNamedQuery -> Bool)
-> Eq CreateNamedQuery
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateNamedQuery -> CreateNamedQuery -> Bool
$c/= :: CreateNamedQuery -> CreateNamedQuery -> Bool
== :: CreateNamedQuery -> CreateNamedQuery -> Bool
$c== :: CreateNamedQuery -> CreateNamedQuery -> Bool
Prelude.Eq, ReadPrec [CreateNamedQuery]
ReadPrec CreateNamedQuery
Int -> ReadS CreateNamedQuery
ReadS [CreateNamedQuery]
(Int -> ReadS CreateNamedQuery)
-> ReadS [CreateNamedQuery]
-> ReadPrec CreateNamedQuery
-> ReadPrec [CreateNamedQuery]
-> Read CreateNamedQuery
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateNamedQuery]
$creadListPrec :: ReadPrec [CreateNamedQuery]
readPrec :: ReadPrec CreateNamedQuery
$creadPrec :: ReadPrec CreateNamedQuery
readList :: ReadS [CreateNamedQuery]
$creadList :: ReadS [CreateNamedQuery]
readsPrec :: Int -> ReadS CreateNamedQuery
$creadsPrec :: Int -> ReadS CreateNamedQuery
Prelude.Read, Int -> CreateNamedQuery -> ShowS
[CreateNamedQuery] -> ShowS
CreateNamedQuery -> String
(Int -> CreateNamedQuery -> ShowS)
-> (CreateNamedQuery -> String)
-> ([CreateNamedQuery] -> ShowS)
-> Show CreateNamedQuery
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateNamedQuery] -> ShowS
$cshowList :: [CreateNamedQuery] -> ShowS
show :: CreateNamedQuery -> String
$cshow :: CreateNamedQuery -> String
showsPrec :: Int -> CreateNamedQuery -> ShowS
$cshowsPrec :: Int -> CreateNamedQuery -> ShowS
Prelude.Show, (forall x. CreateNamedQuery -> Rep CreateNamedQuery x)
-> (forall x. Rep CreateNamedQuery x -> CreateNamedQuery)
-> Generic CreateNamedQuery
forall x. Rep CreateNamedQuery x -> CreateNamedQuery
forall x. CreateNamedQuery -> Rep CreateNamedQuery x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateNamedQuery x -> CreateNamedQuery
$cfrom :: forall x. CreateNamedQuery -> Rep CreateNamedQuery x
Prelude.Generic)

-- |
-- Create a value of 'CreateNamedQuery' 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:
--
-- 'clientRequestToken', 'createNamedQuery_clientRequestToken' - A unique case-sensitive string used to ensure the request to create the
-- query is idempotent (executes only once). If another @CreateNamedQuery@
-- request is received, the same response is returned and another query is
-- not created. If a parameter has changed, for example, the @QueryString@,
-- an error is returned.
--
-- This token is listed as not required because Amazon Web Services SDKs
-- (for example the Amazon Web Services SDK for Java) auto-generate the
-- token for users. If you are not using the Amazon Web Services SDK or the
-- Amazon Web Services CLI, you must provide this token or the action will
-- fail.
--
-- 'description', 'createNamedQuery_description' - The query description.
--
-- 'workGroup', 'createNamedQuery_workGroup' - The name of the workgroup in which the named query is being created.
--
-- 'name', 'createNamedQuery_name' - The query name.
--
-- 'database', 'createNamedQuery_database' - The database to which the query belongs.
--
-- 'queryString', 'createNamedQuery_queryString' - The contents of the query with all query statements.
newCreateNamedQuery ::
  -- | 'name'
  Prelude.Text ->
  -- | 'database'
  Prelude.Text ->
  -- | 'queryString'
  Prelude.Text ->
  CreateNamedQuery
newCreateNamedQuery :: Text -> Text -> Text -> CreateNamedQuery
newCreateNamedQuery Text
pName_ Text
pDatabase_ Text
pQueryString_ =
  CreateNamedQuery' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Text
-> Text
-> Text
-> CreateNamedQuery
CreateNamedQuery'
    { $sel:clientRequestToken:CreateNamedQuery' :: Maybe Text
clientRequestToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:CreateNamedQuery' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:workGroup:CreateNamedQuery' :: Maybe Text
workGroup = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:CreateNamedQuery' :: Text
name = Text
pName_,
      $sel:database:CreateNamedQuery' :: Text
database = Text
pDatabase_,
      $sel:queryString:CreateNamedQuery' :: Text
queryString = Text
pQueryString_
    }

-- | A unique case-sensitive string used to ensure the request to create the
-- query is idempotent (executes only once). If another @CreateNamedQuery@
-- request is received, the same response is returned and another query is
-- not created. If a parameter has changed, for example, the @QueryString@,
-- an error is returned.
--
-- This token is listed as not required because Amazon Web Services SDKs
-- (for example the Amazon Web Services SDK for Java) auto-generate the
-- token for users. If you are not using the Amazon Web Services SDK or the
-- Amazon Web Services CLI, you must provide this token or the action will
-- fail.
createNamedQuery_clientRequestToken :: Lens.Lens' CreateNamedQuery (Prelude.Maybe Prelude.Text)
createNamedQuery_clientRequestToken :: (Maybe Text -> f (Maybe Text))
-> CreateNamedQuery -> f CreateNamedQuery
createNamedQuery_clientRequestToken = (CreateNamedQuery -> Maybe Text)
-> (CreateNamedQuery -> Maybe Text -> CreateNamedQuery)
-> Lens CreateNamedQuery CreateNamedQuery (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateNamedQuery' {Maybe Text
clientRequestToken :: Maybe Text
$sel:clientRequestToken:CreateNamedQuery' :: CreateNamedQuery -> Maybe Text
clientRequestToken} -> Maybe Text
clientRequestToken) (\s :: CreateNamedQuery
s@CreateNamedQuery' {} Maybe Text
a -> CreateNamedQuery
s {$sel:clientRequestToken:CreateNamedQuery' :: Maybe Text
clientRequestToken = Maybe Text
a} :: CreateNamedQuery)

-- | The query description.
createNamedQuery_description :: Lens.Lens' CreateNamedQuery (Prelude.Maybe Prelude.Text)
createNamedQuery_description :: (Maybe Text -> f (Maybe Text))
-> CreateNamedQuery -> f CreateNamedQuery
createNamedQuery_description = (CreateNamedQuery -> Maybe Text)
-> (CreateNamedQuery -> Maybe Text -> CreateNamedQuery)
-> Lens CreateNamedQuery CreateNamedQuery (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateNamedQuery' {Maybe Text
description :: Maybe Text
$sel:description:CreateNamedQuery' :: CreateNamedQuery -> Maybe Text
description} -> Maybe Text
description) (\s :: CreateNamedQuery
s@CreateNamedQuery' {} Maybe Text
a -> CreateNamedQuery
s {$sel:description:CreateNamedQuery' :: Maybe Text
description = Maybe Text
a} :: CreateNamedQuery)

-- | The name of the workgroup in which the named query is being created.
createNamedQuery_workGroup :: Lens.Lens' CreateNamedQuery (Prelude.Maybe Prelude.Text)
createNamedQuery_workGroup :: (Maybe Text -> f (Maybe Text))
-> CreateNamedQuery -> f CreateNamedQuery
createNamedQuery_workGroup = (CreateNamedQuery -> Maybe Text)
-> (CreateNamedQuery -> Maybe Text -> CreateNamedQuery)
-> Lens CreateNamedQuery CreateNamedQuery (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateNamedQuery' {Maybe Text
workGroup :: Maybe Text
$sel:workGroup:CreateNamedQuery' :: CreateNamedQuery -> Maybe Text
workGroup} -> Maybe Text
workGroup) (\s :: CreateNamedQuery
s@CreateNamedQuery' {} Maybe Text
a -> CreateNamedQuery
s {$sel:workGroup:CreateNamedQuery' :: Maybe Text
workGroup = Maybe Text
a} :: CreateNamedQuery)

-- | The query name.
createNamedQuery_name :: Lens.Lens' CreateNamedQuery Prelude.Text
createNamedQuery_name :: (Text -> f Text) -> CreateNamedQuery -> f CreateNamedQuery
createNamedQuery_name = (CreateNamedQuery -> Text)
-> (CreateNamedQuery -> Text -> CreateNamedQuery)
-> Lens CreateNamedQuery CreateNamedQuery Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateNamedQuery' {Text
name :: Text
$sel:name:CreateNamedQuery' :: CreateNamedQuery -> Text
name} -> Text
name) (\s :: CreateNamedQuery
s@CreateNamedQuery' {} Text
a -> CreateNamedQuery
s {$sel:name:CreateNamedQuery' :: Text
name = Text
a} :: CreateNamedQuery)

-- | The database to which the query belongs.
createNamedQuery_database :: Lens.Lens' CreateNamedQuery Prelude.Text
createNamedQuery_database :: (Text -> f Text) -> CreateNamedQuery -> f CreateNamedQuery
createNamedQuery_database = (CreateNamedQuery -> Text)
-> (CreateNamedQuery -> Text -> CreateNamedQuery)
-> Lens CreateNamedQuery CreateNamedQuery Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateNamedQuery' {Text
database :: Text
$sel:database:CreateNamedQuery' :: CreateNamedQuery -> Text
database} -> Text
database) (\s :: CreateNamedQuery
s@CreateNamedQuery' {} Text
a -> CreateNamedQuery
s {$sel:database:CreateNamedQuery' :: Text
database = Text
a} :: CreateNamedQuery)

-- | The contents of the query with all query statements.
createNamedQuery_queryString :: Lens.Lens' CreateNamedQuery Prelude.Text
createNamedQuery_queryString :: (Text -> f Text) -> CreateNamedQuery -> f CreateNamedQuery
createNamedQuery_queryString = (CreateNamedQuery -> Text)
-> (CreateNamedQuery -> Text -> CreateNamedQuery)
-> Lens CreateNamedQuery CreateNamedQuery Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateNamedQuery' {Text
queryString :: Text
$sel:queryString:CreateNamedQuery' :: CreateNamedQuery -> Text
queryString} -> Text
queryString) (\s :: CreateNamedQuery
s@CreateNamedQuery' {} Text
a -> CreateNamedQuery
s {$sel:queryString:CreateNamedQuery' :: Text
queryString = Text
a} :: CreateNamedQuery)

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

instance Prelude.NFData CreateNamedQuery

instance Core.ToHeaders CreateNamedQuery where
  toHeaders :: CreateNamedQuery -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateNamedQuery -> 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
"AmazonAthena.CreateNamedQuery" ::
                          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 CreateNamedQuery where
  toJSON :: CreateNamedQuery -> Value
toJSON CreateNamedQuery' {Maybe Text
Text
queryString :: Text
database :: Text
name :: Text
workGroup :: Maybe Text
description :: Maybe Text
clientRequestToken :: Maybe Text
$sel:queryString:CreateNamedQuery' :: CreateNamedQuery -> Text
$sel:database:CreateNamedQuery' :: CreateNamedQuery -> Text
$sel:name:CreateNamedQuery' :: CreateNamedQuery -> Text
$sel:workGroup:CreateNamedQuery' :: CreateNamedQuery -> Maybe Text
$sel:description:CreateNamedQuery' :: CreateNamedQuery -> Maybe Text
$sel:clientRequestToken:CreateNamedQuery' :: CreateNamedQuery -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (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
"Description" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
description,
            (Text
"WorkGroup" 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
workGroup,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Database" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
database),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"QueryString" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
queryString)
          ]
      )

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

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

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

-- |
-- Create a value of 'CreateNamedQueryResponse' 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:
--
-- 'namedQueryId', 'createNamedQueryResponse_namedQueryId' - The unique ID of the query.
--
-- 'httpStatus', 'createNamedQueryResponse_httpStatus' - The response's http status code.
newCreateNamedQueryResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateNamedQueryResponse
newCreateNamedQueryResponse :: Int -> CreateNamedQueryResponse
newCreateNamedQueryResponse Int
pHttpStatus_ =
  CreateNamedQueryResponse' :: Maybe Text -> Int -> CreateNamedQueryResponse
CreateNamedQueryResponse'
    { $sel:namedQueryId:CreateNamedQueryResponse' :: Maybe Text
namedQueryId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateNamedQueryResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The unique ID of the query.
createNamedQueryResponse_namedQueryId :: Lens.Lens' CreateNamedQueryResponse (Prelude.Maybe Prelude.Text)
createNamedQueryResponse_namedQueryId :: (Maybe Text -> f (Maybe Text))
-> CreateNamedQueryResponse -> f CreateNamedQueryResponse
createNamedQueryResponse_namedQueryId = (CreateNamedQueryResponse -> Maybe Text)
-> (CreateNamedQueryResponse
    -> Maybe Text -> CreateNamedQueryResponse)
-> Lens
     CreateNamedQueryResponse
     CreateNamedQueryResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateNamedQueryResponse' {Maybe Text
namedQueryId :: Maybe Text
$sel:namedQueryId:CreateNamedQueryResponse' :: CreateNamedQueryResponse -> Maybe Text
namedQueryId} -> Maybe Text
namedQueryId) (\s :: CreateNamedQueryResponse
s@CreateNamedQueryResponse' {} Maybe Text
a -> CreateNamedQueryResponse
s {$sel:namedQueryId:CreateNamedQueryResponse' :: Maybe Text
namedQueryId = Maybe Text
a} :: CreateNamedQueryResponse)

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

instance Prelude.NFData CreateNamedQueryResponse