{-# 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.CloudWatchLogs.PutQueryDefinition
-- 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 or updates a query definition for CloudWatch Logs Insights. For
-- more information, see
-- <https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/AnalyzingLogData.html Analyzing Log Data with CloudWatch Logs Insights>.
--
-- To update a query definition, specify its @queryDefinitionId@ in your
-- request. The values of @name@, @queryString@, and @logGroupNames@ are
-- changed to the values that you specify in your update operation. No
-- current values are retained from the current query definition. For
-- example, if you update a current query definition that includes log
-- groups, and you don\'t specify the @logGroupNames@ parameter in your
-- update operation, the query definition changes to contain no log groups.
--
-- You must have the @logs:PutQueryDefinition@ permission to be able to
-- perform this operation.
module Amazonka.CloudWatchLogs.PutQueryDefinition
  ( -- * Creating a Request
    PutQueryDefinition (..),
    newPutQueryDefinition,

    -- * Request Lenses
    putQueryDefinition_logGroupNames,
    putQueryDefinition_queryDefinitionId,
    putQueryDefinition_name,
    putQueryDefinition_queryString,

    -- * Destructuring the Response
    PutQueryDefinitionResponse (..),
    newPutQueryDefinitionResponse,

    -- * Response Lenses
    putQueryDefinitionResponse_queryDefinitionId,
    putQueryDefinitionResponse_httpStatus,
  )
where

import Amazonka.CloudWatchLogs.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:/ 'newPutQueryDefinition' smart constructor.
data PutQueryDefinition = PutQueryDefinition'
  { -- | Use this parameter to include specific log groups as part of your query
    -- definition.
    --
    -- If you are updating a query definition and you omit this parameter, then
    -- the updated definition will contain no log groups.
    PutQueryDefinition -> Maybe [Text]
logGroupNames :: Prelude.Maybe [Prelude.Text],
    -- | If you are updating a query definition, use this parameter to specify
    -- the ID of the query definition that you want to update. You can use
    -- <https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_DescribeQueryDefinitions.html DescribeQueryDefinitions>
    -- to retrieve the IDs of your saved query definitions.
    --
    -- If you are creating a query definition, do not specify this parameter.
    -- CloudWatch generates a unique ID for the new query definition and
    -- include it in the response to this operation.
    PutQueryDefinition -> Maybe Text
queryDefinitionId :: Prelude.Maybe Prelude.Text,
    -- | A name for the query definition. If you are saving a lot of query
    -- definitions, we recommend that you name them so that you can easily find
    -- the ones you want by using the first part of the name as a filter in the
    -- @queryDefinitionNamePrefix@ parameter of
    -- <https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_DescribeQueryDefinitions.html DescribeQueryDefinitions>.
    PutQueryDefinition -> Text
name :: Prelude.Text,
    -- | The query string to use for this definition. For more information, see
    -- <https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_QuerySyntax.html CloudWatch Logs Insights Query Syntax>.
    PutQueryDefinition -> Text
queryString :: Prelude.Text
  }
  deriving (PutQueryDefinition -> PutQueryDefinition -> Bool
(PutQueryDefinition -> PutQueryDefinition -> Bool)
-> (PutQueryDefinition -> PutQueryDefinition -> Bool)
-> Eq PutQueryDefinition
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutQueryDefinition -> PutQueryDefinition -> Bool
$c/= :: PutQueryDefinition -> PutQueryDefinition -> Bool
== :: PutQueryDefinition -> PutQueryDefinition -> Bool
$c== :: PutQueryDefinition -> PutQueryDefinition -> Bool
Prelude.Eq, ReadPrec [PutQueryDefinition]
ReadPrec PutQueryDefinition
Int -> ReadS PutQueryDefinition
ReadS [PutQueryDefinition]
(Int -> ReadS PutQueryDefinition)
-> ReadS [PutQueryDefinition]
-> ReadPrec PutQueryDefinition
-> ReadPrec [PutQueryDefinition]
-> Read PutQueryDefinition
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutQueryDefinition]
$creadListPrec :: ReadPrec [PutQueryDefinition]
readPrec :: ReadPrec PutQueryDefinition
$creadPrec :: ReadPrec PutQueryDefinition
readList :: ReadS [PutQueryDefinition]
$creadList :: ReadS [PutQueryDefinition]
readsPrec :: Int -> ReadS PutQueryDefinition
$creadsPrec :: Int -> ReadS PutQueryDefinition
Prelude.Read, Int -> PutQueryDefinition -> ShowS
[PutQueryDefinition] -> ShowS
PutQueryDefinition -> String
(Int -> PutQueryDefinition -> ShowS)
-> (PutQueryDefinition -> String)
-> ([PutQueryDefinition] -> ShowS)
-> Show PutQueryDefinition
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutQueryDefinition] -> ShowS
$cshowList :: [PutQueryDefinition] -> ShowS
show :: PutQueryDefinition -> String
$cshow :: PutQueryDefinition -> String
showsPrec :: Int -> PutQueryDefinition -> ShowS
$cshowsPrec :: Int -> PutQueryDefinition -> ShowS
Prelude.Show, (forall x. PutQueryDefinition -> Rep PutQueryDefinition x)
-> (forall x. Rep PutQueryDefinition x -> PutQueryDefinition)
-> Generic PutQueryDefinition
forall x. Rep PutQueryDefinition x -> PutQueryDefinition
forall x. PutQueryDefinition -> Rep PutQueryDefinition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutQueryDefinition x -> PutQueryDefinition
$cfrom :: forall x. PutQueryDefinition -> Rep PutQueryDefinition x
Prelude.Generic)

-- |
-- Create a value of 'PutQueryDefinition' 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:
--
-- 'logGroupNames', 'putQueryDefinition_logGroupNames' - Use this parameter to include specific log groups as part of your query
-- definition.
--
-- If you are updating a query definition and you omit this parameter, then
-- the updated definition will contain no log groups.
--
-- 'queryDefinitionId', 'putQueryDefinition_queryDefinitionId' - If you are updating a query definition, use this parameter to specify
-- the ID of the query definition that you want to update. You can use
-- <https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_DescribeQueryDefinitions.html DescribeQueryDefinitions>
-- to retrieve the IDs of your saved query definitions.
--
-- If you are creating a query definition, do not specify this parameter.
-- CloudWatch generates a unique ID for the new query definition and
-- include it in the response to this operation.
--
-- 'name', 'putQueryDefinition_name' - A name for the query definition. If you are saving a lot of query
-- definitions, we recommend that you name them so that you can easily find
-- the ones you want by using the first part of the name as a filter in the
-- @queryDefinitionNamePrefix@ parameter of
-- <https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_DescribeQueryDefinitions.html DescribeQueryDefinitions>.
--
-- 'queryString', 'putQueryDefinition_queryString' - The query string to use for this definition. For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_QuerySyntax.html CloudWatch Logs Insights Query Syntax>.
newPutQueryDefinition ::
  -- | 'name'
  Prelude.Text ->
  -- | 'queryString'
  Prelude.Text ->
  PutQueryDefinition
newPutQueryDefinition :: Text -> Text -> PutQueryDefinition
newPutQueryDefinition Text
pName_ Text
pQueryString_ =
  PutQueryDefinition' :: Maybe [Text] -> Maybe Text -> Text -> Text -> PutQueryDefinition
PutQueryDefinition'
    { $sel:logGroupNames:PutQueryDefinition' :: Maybe [Text]
logGroupNames =
        Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:queryDefinitionId:PutQueryDefinition' :: Maybe Text
queryDefinitionId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:PutQueryDefinition' :: Text
name = Text
pName_,
      $sel:queryString:PutQueryDefinition' :: Text
queryString = Text
pQueryString_
    }

-- | Use this parameter to include specific log groups as part of your query
-- definition.
--
-- If you are updating a query definition and you omit this parameter, then
-- the updated definition will contain no log groups.
putQueryDefinition_logGroupNames :: Lens.Lens' PutQueryDefinition (Prelude.Maybe [Prelude.Text])
putQueryDefinition_logGroupNames :: (Maybe [Text] -> f (Maybe [Text]))
-> PutQueryDefinition -> f PutQueryDefinition
putQueryDefinition_logGroupNames = (PutQueryDefinition -> Maybe [Text])
-> (PutQueryDefinition -> Maybe [Text] -> PutQueryDefinition)
-> Lens
     PutQueryDefinition PutQueryDefinition (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutQueryDefinition' {Maybe [Text]
logGroupNames :: Maybe [Text]
$sel:logGroupNames:PutQueryDefinition' :: PutQueryDefinition -> Maybe [Text]
logGroupNames} -> Maybe [Text]
logGroupNames) (\s :: PutQueryDefinition
s@PutQueryDefinition' {} Maybe [Text]
a -> PutQueryDefinition
s {$sel:logGroupNames:PutQueryDefinition' :: Maybe [Text]
logGroupNames = Maybe [Text]
a} :: PutQueryDefinition) ((Maybe [Text] -> f (Maybe [Text]))
 -> PutQueryDefinition -> f PutQueryDefinition)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> PutQueryDefinition
-> f PutQueryDefinition
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | If you are updating a query definition, use this parameter to specify
-- the ID of the query definition that you want to update. You can use
-- <https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_DescribeQueryDefinitions.html DescribeQueryDefinitions>
-- to retrieve the IDs of your saved query definitions.
--
-- If you are creating a query definition, do not specify this parameter.
-- CloudWatch generates a unique ID for the new query definition and
-- include it in the response to this operation.
putQueryDefinition_queryDefinitionId :: Lens.Lens' PutQueryDefinition (Prelude.Maybe Prelude.Text)
putQueryDefinition_queryDefinitionId :: (Maybe Text -> f (Maybe Text))
-> PutQueryDefinition -> f PutQueryDefinition
putQueryDefinition_queryDefinitionId = (PutQueryDefinition -> Maybe Text)
-> (PutQueryDefinition -> Maybe Text -> PutQueryDefinition)
-> Lens
     PutQueryDefinition PutQueryDefinition (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutQueryDefinition' {Maybe Text
queryDefinitionId :: Maybe Text
$sel:queryDefinitionId:PutQueryDefinition' :: PutQueryDefinition -> Maybe Text
queryDefinitionId} -> Maybe Text
queryDefinitionId) (\s :: PutQueryDefinition
s@PutQueryDefinition' {} Maybe Text
a -> PutQueryDefinition
s {$sel:queryDefinitionId:PutQueryDefinition' :: Maybe Text
queryDefinitionId = Maybe Text
a} :: PutQueryDefinition)

-- | A name for the query definition. If you are saving a lot of query
-- definitions, we recommend that you name them so that you can easily find
-- the ones you want by using the first part of the name as a filter in the
-- @queryDefinitionNamePrefix@ parameter of
-- <https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_DescribeQueryDefinitions.html DescribeQueryDefinitions>.
putQueryDefinition_name :: Lens.Lens' PutQueryDefinition Prelude.Text
putQueryDefinition_name :: (Text -> f Text) -> PutQueryDefinition -> f PutQueryDefinition
putQueryDefinition_name = (PutQueryDefinition -> Text)
-> (PutQueryDefinition -> Text -> PutQueryDefinition)
-> Lens PutQueryDefinition PutQueryDefinition Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutQueryDefinition' {Text
name :: Text
$sel:name:PutQueryDefinition' :: PutQueryDefinition -> Text
name} -> Text
name) (\s :: PutQueryDefinition
s@PutQueryDefinition' {} Text
a -> PutQueryDefinition
s {$sel:name:PutQueryDefinition' :: Text
name = Text
a} :: PutQueryDefinition)

-- | The query string to use for this definition. For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_QuerySyntax.html CloudWatch Logs Insights Query Syntax>.
putQueryDefinition_queryString :: Lens.Lens' PutQueryDefinition Prelude.Text
putQueryDefinition_queryString :: (Text -> f Text) -> PutQueryDefinition -> f PutQueryDefinition
putQueryDefinition_queryString = (PutQueryDefinition -> Text)
-> (PutQueryDefinition -> Text -> PutQueryDefinition)
-> Lens PutQueryDefinition PutQueryDefinition Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutQueryDefinition' {Text
queryString :: Text
$sel:queryString:PutQueryDefinition' :: PutQueryDefinition -> Text
queryString} -> Text
queryString) (\s :: PutQueryDefinition
s@PutQueryDefinition' {} Text
a -> PutQueryDefinition
s {$sel:queryString:PutQueryDefinition' :: Text
queryString = Text
a} :: PutQueryDefinition)

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

instance Prelude.NFData PutQueryDefinition

instance Core.ToHeaders PutQueryDefinition where
  toHeaders :: PutQueryDefinition -> ResponseHeaders
toHeaders =
    ResponseHeaders -> PutQueryDefinition -> 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
"Logs_20140328.PutQueryDefinition" ::
                          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 PutQueryDefinition where
  toJSON :: PutQueryDefinition -> Value
toJSON PutQueryDefinition' {Maybe [Text]
Maybe Text
Text
queryString :: Text
name :: Text
queryDefinitionId :: Maybe Text
logGroupNames :: Maybe [Text]
$sel:queryString:PutQueryDefinition' :: PutQueryDefinition -> Text
$sel:name:PutQueryDefinition' :: PutQueryDefinition -> Text
$sel:queryDefinitionId:PutQueryDefinition' :: PutQueryDefinition -> Maybe Text
$sel:logGroupNames:PutQueryDefinition' :: PutQueryDefinition -> Maybe [Text]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"logGroupNames" 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]
logGroupNames,
            (Text
"queryDefinitionId" 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
queryDefinitionId,
            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
"queryString" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
queryString)
          ]
      )

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

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

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

-- |
-- Create a value of 'PutQueryDefinitionResponse' 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:
--
-- 'queryDefinitionId', 'putQueryDefinitionResponse_queryDefinitionId' - The ID of the query definition.
--
-- 'httpStatus', 'putQueryDefinitionResponse_httpStatus' - The response's http status code.
newPutQueryDefinitionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  PutQueryDefinitionResponse
newPutQueryDefinitionResponse :: Int -> PutQueryDefinitionResponse
newPutQueryDefinitionResponse Int
pHttpStatus_ =
  PutQueryDefinitionResponse' :: Maybe Text -> Int -> PutQueryDefinitionResponse
PutQueryDefinitionResponse'
    { $sel:queryDefinitionId:PutQueryDefinitionResponse' :: Maybe Text
queryDefinitionId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:PutQueryDefinitionResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The ID of the query definition.
putQueryDefinitionResponse_queryDefinitionId :: Lens.Lens' PutQueryDefinitionResponse (Prelude.Maybe Prelude.Text)
putQueryDefinitionResponse_queryDefinitionId :: (Maybe Text -> f (Maybe Text))
-> PutQueryDefinitionResponse -> f PutQueryDefinitionResponse
putQueryDefinitionResponse_queryDefinitionId = (PutQueryDefinitionResponse -> Maybe Text)
-> (PutQueryDefinitionResponse
    -> Maybe Text -> PutQueryDefinitionResponse)
-> Lens
     PutQueryDefinitionResponse
     PutQueryDefinitionResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutQueryDefinitionResponse' {Maybe Text
queryDefinitionId :: Maybe Text
$sel:queryDefinitionId:PutQueryDefinitionResponse' :: PutQueryDefinitionResponse -> Maybe Text
queryDefinitionId} -> Maybe Text
queryDefinitionId) (\s :: PutQueryDefinitionResponse
s@PutQueryDefinitionResponse' {} Maybe Text
a -> PutQueryDefinitionResponse
s {$sel:queryDefinitionId:PutQueryDefinitionResponse' :: Maybe Text
queryDefinitionId = Maybe Text
a} :: PutQueryDefinitionResponse)

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

instance Prelude.NFData PutQueryDefinitionResponse