{-# 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.SQS.TagQueue
-- 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)
--
-- Add cost allocation tags to the specified Amazon SQS queue. For an
-- overview, see
-- <https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-queue-tags.html Tagging Your Amazon SQS Queues>
-- in the /Amazon SQS Developer Guide/.
--
-- When you use queue tags, keep the following guidelines in mind:
--
-- -   Adding more than 50 tags to a queue isn\'t recommended.
--
-- -   Tags don\'t have any semantic meaning. Amazon SQS interprets tags as
--     character strings.
--
-- -   Tags are case-sensitive.
--
-- -   A new tag with a key identical to that of an existing tag overwrites
--     the existing tag.
--
-- For a full list of tag restrictions, see
-- <https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-limits.html#limits-queues Quotas related to queues>
-- in the /Amazon SQS Developer Guide/.
--
-- Cross-account permissions don\'t apply to this action. For more
-- information, see
-- <https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-customer-managed-policy-examples.html#grant-cross-account-permissions-to-role-and-user-name Grant cross-account permissions to a role and a user name>
-- in the /Amazon SQS Developer Guide/.
module Amazonka.SQS.TagQueue
  ( -- * Creating a Request
    TagQueue (..),
    newTagQueue,

    -- * Request Lenses
    tagQueue_queueUrl,
    tagQueue_tags,

    -- * Destructuring the Response
    TagQueueResponse (..),
    newTagQueueResponse,
  )
where

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
import Amazonka.SQS.Types

-- | /See:/ 'newTagQueue' smart constructor.
data TagQueue = TagQueue'
  { -- | The URL of the queue.
    TagQueue -> Text
queueUrl :: Prelude.Text,
    -- | The list of tags to be added to the specified queue.
    TagQueue -> HashMap Text Text
tags :: Prelude.HashMap Prelude.Text Prelude.Text
  }
  deriving (TagQueue -> TagQueue -> Bool
(TagQueue -> TagQueue -> Bool)
-> (TagQueue -> TagQueue -> Bool) -> Eq TagQueue
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TagQueue -> TagQueue -> Bool
$c/= :: TagQueue -> TagQueue -> Bool
== :: TagQueue -> TagQueue -> Bool
$c== :: TagQueue -> TagQueue -> Bool
Prelude.Eq, ReadPrec [TagQueue]
ReadPrec TagQueue
Int -> ReadS TagQueue
ReadS [TagQueue]
(Int -> ReadS TagQueue)
-> ReadS [TagQueue]
-> ReadPrec TagQueue
-> ReadPrec [TagQueue]
-> Read TagQueue
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TagQueue]
$creadListPrec :: ReadPrec [TagQueue]
readPrec :: ReadPrec TagQueue
$creadPrec :: ReadPrec TagQueue
readList :: ReadS [TagQueue]
$creadList :: ReadS [TagQueue]
readsPrec :: Int -> ReadS TagQueue
$creadsPrec :: Int -> ReadS TagQueue
Prelude.Read, Int -> TagQueue -> ShowS
[TagQueue] -> ShowS
TagQueue -> String
(Int -> TagQueue -> ShowS)
-> (TagQueue -> String) -> ([TagQueue] -> ShowS) -> Show TagQueue
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TagQueue] -> ShowS
$cshowList :: [TagQueue] -> ShowS
show :: TagQueue -> String
$cshow :: TagQueue -> String
showsPrec :: Int -> TagQueue -> ShowS
$cshowsPrec :: Int -> TagQueue -> ShowS
Prelude.Show, (forall x. TagQueue -> Rep TagQueue x)
-> (forall x. Rep TagQueue x -> TagQueue) -> Generic TagQueue
forall x. Rep TagQueue x -> TagQueue
forall x. TagQueue -> Rep TagQueue x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TagQueue x -> TagQueue
$cfrom :: forall x. TagQueue -> Rep TagQueue x
Prelude.Generic)

-- |
-- Create a value of 'TagQueue' 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:
--
-- 'queueUrl', 'tagQueue_queueUrl' - The URL of the queue.
--
-- 'tags', 'tagQueue_tags' - The list of tags to be added to the specified queue.
newTagQueue ::
  -- | 'queueUrl'
  Prelude.Text ->
  TagQueue
newTagQueue :: Text -> TagQueue
newTagQueue Text
pQueueUrl_ =
  TagQueue' :: Text -> HashMap Text Text -> TagQueue
TagQueue'
    { $sel:queueUrl:TagQueue' :: Text
queueUrl = Text
pQueueUrl_,
      $sel:tags:TagQueue' :: HashMap Text Text
tags = HashMap Text Text
forall a. Monoid a => a
Prelude.mempty
    }

-- | The URL of the queue.
tagQueue_queueUrl :: Lens.Lens' TagQueue Prelude.Text
tagQueue_queueUrl :: (Text -> f Text) -> TagQueue -> f TagQueue
tagQueue_queueUrl = (TagQueue -> Text)
-> (TagQueue -> Text -> TagQueue)
-> Lens TagQueue TagQueue Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TagQueue' {Text
queueUrl :: Text
$sel:queueUrl:TagQueue' :: TagQueue -> Text
queueUrl} -> Text
queueUrl) (\s :: TagQueue
s@TagQueue' {} Text
a -> TagQueue
s {$sel:queueUrl:TagQueue' :: Text
queueUrl = Text
a} :: TagQueue)

-- | The list of tags to be added to the specified queue.
tagQueue_tags :: Lens.Lens' TagQueue (Prelude.HashMap Prelude.Text Prelude.Text)
tagQueue_tags :: (HashMap Text Text -> f (HashMap Text Text))
-> TagQueue -> f TagQueue
tagQueue_tags = (TagQueue -> HashMap Text Text)
-> (TagQueue -> HashMap Text Text -> TagQueue)
-> Lens TagQueue TagQueue (HashMap Text Text) (HashMap Text Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TagQueue' {HashMap Text Text
tags :: HashMap Text Text
$sel:tags:TagQueue' :: TagQueue -> HashMap Text Text
tags} -> HashMap Text Text
tags) (\s :: TagQueue
s@TagQueue' {} HashMap Text Text
a -> TagQueue
s {$sel:tags:TagQueue' :: HashMap Text Text
tags = HashMap Text Text
a} :: TagQueue) ((HashMap Text Text -> f (HashMap Text Text))
 -> TagQueue -> f TagQueue)
-> ((HashMap Text Text -> f (HashMap Text Text))
    -> HashMap Text Text -> f (HashMap Text Text))
-> (HashMap Text Text -> f (HashMap Text Text))
-> TagQueue
-> f TagQueue
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (HashMap Text Text -> f (HashMap Text Text))
-> HashMap Text Text -> f (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.AWSRequest TagQueue where
  type AWSResponse TagQueue = TagQueueResponse
  request :: TagQueue -> Request TagQueue
request = Service -> TagQueue -> Request TagQueue
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy TagQueue
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse TagQueue)))
response = AWSResponse TagQueue
-> Logger
-> Service
-> Proxy TagQueue
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse TagQueue)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse TagQueue
TagQueueResponse
TagQueueResponse'

instance Prelude.Hashable TagQueue

instance Prelude.NFData TagQueue

instance Core.ToHeaders TagQueue where
  toHeaders :: TagQueue -> [Header]
toHeaders = [Header] -> TagQueue -> [Header]
forall a b. a -> b -> a
Prelude.const [Header]
forall a. Monoid a => a
Prelude.mempty

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

instance Core.ToQuery TagQueue where
  toQuery :: TagQueue -> QueryString
toQuery TagQueue' {Text
HashMap Text Text
tags :: HashMap Text Text
queueUrl :: Text
$sel:tags:TagQueue' :: TagQueue -> HashMap Text Text
$sel:queueUrl:TagQueue' :: TagQueue -> Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action" ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"TagQueue" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2012-11-05" :: Prelude.ByteString),
        ByteString
"QueueUrl" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
queueUrl,
        ByteString
-> ByteString -> ByteString -> HashMap Text Text -> QueryString
forall k v.
(ToQuery k, ToQuery v) =>
ByteString
-> ByteString -> ByteString -> HashMap k v -> QueryString
Core.toQueryMap ByteString
"Tags" ByteString
"Key" ByteString
"Value" HashMap Text Text
tags
      ]

-- | /See:/ 'newTagQueueResponse' smart constructor.
data TagQueueResponse = TagQueueResponse'
  {
  }
  deriving (TagQueueResponse -> TagQueueResponse -> Bool
(TagQueueResponse -> TagQueueResponse -> Bool)
-> (TagQueueResponse -> TagQueueResponse -> Bool)
-> Eq TagQueueResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TagQueueResponse -> TagQueueResponse -> Bool
$c/= :: TagQueueResponse -> TagQueueResponse -> Bool
== :: TagQueueResponse -> TagQueueResponse -> Bool
$c== :: TagQueueResponse -> TagQueueResponse -> Bool
Prelude.Eq, ReadPrec [TagQueueResponse]
ReadPrec TagQueueResponse
Int -> ReadS TagQueueResponse
ReadS [TagQueueResponse]
(Int -> ReadS TagQueueResponse)
-> ReadS [TagQueueResponse]
-> ReadPrec TagQueueResponse
-> ReadPrec [TagQueueResponse]
-> Read TagQueueResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TagQueueResponse]
$creadListPrec :: ReadPrec [TagQueueResponse]
readPrec :: ReadPrec TagQueueResponse
$creadPrec :: ReadPrec TagQueueResponse
readList :: ReadS [TagQueueResponse]
$creadList :: ReadS [TagQueueResponse]
readsPrec :: Int -> ReadS TagQueueResponse
$creadsPrec :: Int -> ReadS TagQueueResponse
Prelude.Read, Int -> TagQueueResponse -> ShowS
[TagQueueResponse] -> ShowS
TagQueueResponse -> String
(Int -> TagQueueResponse -> ShowS)
-> (TagQueueResponse -> String)
-> ([TagQueueResponse] -> ShowS)
-> Show TagQueueResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TagQueueResponse] -> ShowS
$cshowList :: [TagQueueResponse] -> ShowS
show :: TagQueueResponse -> String
$cshow :: TagQueueResponse -> String
showsPrec :: Int -> TagQueueResponse -> ShowS
$cshowsPrec :: Int -> TagQueueResponse -> ShowS
Prelude.Show, (forall x. TagQueueResponse -> Rep TagQueueResponse x)
-> (forall x. Rep TagQueueResponse x -> TagQueueResponse)
-> Generic TagQueueResponse
forall x. Rep TagQueueResponse x -> TagQueueResponse
forall x. TagQueueResponse -> Rep TagQueueResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TagQueueResponse x -> TagQueueResponse
$cfrom :: forall x. TagQueueResponse -> Rep TagQueueResponse x
Prelude.Generic)

-- |
-- Create a value of 'TagQueueResponse' 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.
newTagQueueResponse ::
  TagQueueResponse
newTagQueueResponse :: TagQueueResponse
newTagQueueResponse = TagQueueResponse
TagQueueResponse'

instance Prelude.NFData TagQueueResponse