{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.ElasticBeanstalk.Types.Queue
-- 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)
module Amazonka.ElasticBeanstalk.Types.Queue where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Describes a queue.
--
-- /See:/ 'newQueue' smart constructor.
data Queue = Queue'
  { -- | The URL of the queue.
    Queue -> Maybe Text
url :: Prelude.Maybe Prelude.Text,
    -- | The name of the queue.
    Queue -> Maybe Text
name :: Prelude.Maybe Prelude.Text
  }
  deriving (Queue -> Queue -> Bool
(Queue -> Queue -> Bool) -> (Queue -> Queue -> Bool) -> Eq Queue
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Queue -> Queue -> Bool
$c/= :: Queue -> Queue -> Bool
== :: Queue -> Queue -> Bool
$c== :: Queue -> Queue -> Bool
Prelude.Eq, ReadPrec [Queue]
ReadPrec Queue
Int -> ReadS Queue
ReadS [Queue]
(Int -> ReadS Queue)
-> ReadS [Queue]
-> ReadPrec Queue
-> ReadPrec [Queue]
-> Read Queue
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Queue]
$creadListPrec :: ReadPrec [Queue]
readPrec :: ReadPrec Queue
$creadPrec :: ReadPrec Queue
readList :: ReadS [Queue]
$creadList :: ReadS [Queue]
readsPrec :: Int -> ReadS Queue
$creadsPrec :: Int -> ReadS Queue
Prelude.Read, Int -> Queue -> ShowS
[Queue] -> ShowS
Queue -> String
(Int -> Queue -> ShowS)
-> (Queue -> String) -> ([Queue] -> ShowS) -> Show Queue
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Queue] -> ShowS
$cshowList :: [Queue] -> ShowS
show :: Queue -> String
$cshow :: Queue -> String
showsPrec :: Int -> Queue -> ShowS
$cshowsPrec :: Int -> Queue -> ShowS
Prelude.Show, (forall x. Queue -> Rep Queue x)
-> (forall x. Rep Queue x -> Queue) -> Generic Queue
forall x. Rep Queue x -> Queue
forall x. Queue -> Rep Queue x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Queue x -> Queue
$cfrom :: forall x. Queue -> Rep Queue x
Prelude.Generic)

-- |
-- Create a value of 'Queue' 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:
--
-- 'url', 'queue_url' - The URL of the queue.
--
-- 'name', 'queue_name' - The name of the queue.
newQueue ::
  Queue
newQueue :: Queue
newQueue =
  Queue' :: Maybe Text -> Maybe Text -> Queue
Queue'
    { $sel:url:Queue' :: Maybe Text
url = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:Queue' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

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

-- | The name of the queue.
queue_name :: Lens.Lens' Queue (Prelude.Maybe Prelude.Text)
queue_name :: (Maybe Text -> f (Maybe Text)) -> Queue -> f Queue
queue_name = (Queue -> Maybe Text)
-> (Queue -> Maybe Text -> Queue)
-> Lens Queue Queue (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Queue' {Maybe Text
name :: Maybe Text
$sel:name:Queue' :: Queue -> Maybe Text
name} -> Maybe Text
name) (\s :: Queue
s@Queue' {} Maybe Text
a -> Queue
s {$sel:name:Queue' :: Maybe Text
name = Maybe Text
a} :: Queue)

instance Core.FromXML Queue where
  parseXML :: [Node] -> Either String Queue
parseXML [Node]
x =
    Maybe Text -> Maybe Text -> Queue
Queue'
      (Maybe Text -> Maybe Text -> Queue)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Queue)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"URL") Either String (Maybe Text -> Queue)
-> Either String (Maybe Text) -> Either String Queue
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Name")

instance Prelude.Hashable Queue

instance Prelude.NFData Queue