{-# 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.Batch.Types.SchedulingPolicyDetail
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Batch.Types.SchedulingPolicyDetail where

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

-- | An object that represents a scheduling policy.
--
-- /See:/ 'newSchedulingPolicyDetail' smart constructor.
data SchedulingPolicyDetail = SchedulingPolicyDetail'
  { -- | The fair share policy for the scheduling policy.
    SchedulingPolicyDetail -> Maybe FairsharePolicy
fairsharePolicy :: Prelude.Maybe FairsharePolicy,
    -- | The tags that you apply to the scheduling policy to categorize and
    -- organize your resources. Each tag consists of a key and an optional
    -- value. For more information, see
    -- <https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html Tagging Amazon Web Services resources>
    -- in /Amazon Web Services General Reference/.
    SchedulingPolicyDetail -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The name of the scheduling policy.
    SchedulingPolicyDetail -> Text
name :: Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the scheduling policy. An example is
    -- @arn:@/@aws@/@:batch:@/@us-east-1@/@:@/@123456789012@/@:scheduling-policy\/@/@HighPriority@/@ @.
    SchedulingPolicyDetail -> Text
arn :: Prelude.Text
  }
  deriving (SchedulingPolicyDetail -> SchedulingPolicyDetail -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SchedulingPolicyDetail -> SchedulingPolicyDetail -> Bool
$c/= :: SchedulingPolicyDetail -> SchedulingPolicyDetail -> Bool
== :: SchedulingPolicyDetail -> SchedulingPolicyDetail -> Bool
$c== :: SchedulingPolicyDetail -> SchedulingPolicyDetail -> Bool
Prelude.Eq, ReadPrec [SchedulingPolicyDetail]
ReadPrec SchedulingPolicyDetail
Int -> ReadS SchedulingPolicyDetail
ReadS [SchedulingPolicyDetail]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SchedulingPolicyDetail]
$creadListPrec :: ReadPrec [SchedulingPolicyDetail]
readPrec :: ReadPrec SchedulingPolicyDetail
$creadPrec :: ReadPrec SchedulingPolicyDetail
readList :: ReadS [SchedulingPolicyDetail]
$creadList :: ReadS [SchedulingPolicyDetail]
readsPrec :: Int -> ReadS SchedulingPolicyDetail
$creadsPrec :: Int -> ReadS SchedulingPolicyDetail
Prelude.Read, Int -> SchedulingPolicyDetail -> ShowS
[SchedulingPolicyDetail] -> ShowS
SchedulingPolicyDetail -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SchedulingPolicyDetail] -> ShowS
$cshowList :: [SchedulingPolicyDetail] -> ShowS
show :: SchedulingPolicyDetail -> String
$cshow :: SchedulingPolicyDetail -> String
showsPrec :: Int -> SchedulingPolicyDetail -> ShowS
$cshowsPrec :: Int -> SchedulingPolicyDetail -> ShowS
Prelude.Show, forall x. Rep SchedulingPolicyDetail x -> SchedulingPolicyDetail
forall x. SchedulingPolicyDetail -> Rep SchedulingPolicyDetail x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SchedulingPolicyDetail x -> SchedulingPolicyDetail
$cfrom :: forall x. SchedulingPolicyDetail -> Rep SchedulingPolicyDetail x
Prelude.Generic)

-- |
-- Create a value of 'SchedulingPolicyDetail' 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:
--
-- 'fairsharePolicy', 'schedulingPolicyDetail_fairsharePolicy' - The fair share policy for the scheduling policy.
--
-- 'tags', 'schedulingPolicyDetail_tags' - The tags that you apply to the scheduling policy to categorize and
-- organize your resources. Each tag consists of a key and an optional
-- value. For more information, see
-- <https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html Tagging Amazon Web Services resources>
-- in /Amazon Web Services General Reference/.
--
-- 'name', 'schedulingPolicyDetail_name' - The name of the scheduling policy.
--
-- 'arn', 'schedulingPolicyDetail_arn' - The Amazon Resource Name (ARN) of the scheduling policy. An example is
-- @arn:@/@aws@/@:batch:@/@us-east-1@/@:@/@123456789012@/@:scheduling-policy\/@/@HighPriority@/@ @.
newSchedulingPolicyDetail ::
  -- | 'name'
  Prelude.Text ->
  -- | 'arn'
  Prelude.Text ->
  SchedulingPolicyDetail
newSchedulingPolicyDetail :: Text -> Text -> SchedulingPolicyDetail
newSchedulingPolicyDetail Text
pName_ Text
pArn_ =
  SchedulingPolicyDetail'
    { $sel:fairsharePolicy:SchedulingPolicyDetail' :: Maybe FairsharePolicy
fairsharePolicy =
        forall a. Maybe a
Prelude.Nothing,
      $sel:tags:SchedulingPolicyDetail' :: Maybe (HashMap Text Text)
tags = forall a. Maybe a
Prelude.Nothing,
      $sel:name:SchedulingPolicyDetail' :: Text
name = Text
pName_,
      $sel:arn:SchedulingPolicyDetail' :: Text
arn = Text
pArn_
    }

-- | The fair share policy for the scheduling policy.
schedulingPolicyDetail_fairsharePolicy :: Lens.Lens' SchedulingPolicyDetail (Prelude.Maybe FairsharePolicy)
schedulingPolicyDetail_fairsharePolicy :: Lens' SchedulingPolicyDetail (Maybe FairsharePolicy)
schedulingPolicyDetail_fairsharePolicy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SchedulingPolicyDetail' {Maybe FairsharePolicy
fairsharePolicy :: Maybe FairsharePolicy
$sel:fairsharePolicy:SchedulingPolicyDetail' :: SchedulingPolicyDetail -> Maybe FairsharePolicy
fairsharePolicy} -> Maybe FairsharePolicy
fairsharePolicy) (\s :: SchedulingPolicyDetail
s@SchedulingPolicyDetail' {} Maybe FairsharePolicy
a -> SchedulingPolicyDetail
s {$sel:fairsharePolicy:SchedulingPolicyDetail' :: Maybe FairsharePolicy
fairsharePolicy = Maybe FairsharePolicy
a} :: SchedulingPolicyDetail)

-- | The tags that you apply to the scheduling policy to categorize and
-- organize your resources. Each tag consists of a key and an optional
-- value. For more information, see
-- <https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html Tagging Amazon Web Services resources>
-- in /Amazon Web Services General Reference/.
schedulingPolicyDetail_tags :: Lens.Lens' SchedulingPolicyDetail (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
schedulingPolicyDetail_tags :: Lens' SchedulingPolicyDetail (Maybe (HashMap Text Text))
schedulingPolicyDetail_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SchedulingPolicyDetail' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:SchedulingPolicyDetail' :: SchedulingPolicyDetail -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: SchedulingPolicyDetail
s@SchedulingPolicyDetail' {} Maybe (HashMap Text Text)
a -> SchedulingPolicyDetail
s {$sel:tags:SchedulingPolicyDetail' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: SchedulingPolicyDetail) 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 name of the scheduling policy.
schedulingPolicyDetail_name :: Lens.Lens' SchedulingPolicyDetail Prelude.Text
schedulingPolicyDetail_name :: Lens' SchedulingPolicyDetail Text
schedulingPolicyDetail_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SchedulingPolicyDetail' {Text
name :: Text
$sel:name:SchedulingPolicyDetail' :: SchedulingPolicyDetail -> Text
name} -> Text
name) (\s :: SchedulingPolicyDetail
s@SchedulingPolicyDetail' {} Text
a -> SchedulingPolicyDetail
s {$sel:name:SchedulingPolicyDetail' :: Text
name = Text
a} :: SchedulingPolicyDetail)

-- | The Amazon Resource Name (ARN) of the scheduling policy. An example is
-- @arn:@/@aws@/@:batch:@/@us-east-1@/@:@/@123456789012@/@:scheduling-policy\/@/@HighPriority@/@ @.
schedulingPolicyDetail_arn :: Lens.Lens' SchedulingPolicyDetail Prelude.Text
schedulingPolicyDetail_arn :: Lens' SchedulingPolicyDetail Text
schedulingPolicyDetail_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SchedulingPolicyDetail' {Text
arn :: Text
$sel:arn:SchedulingPolicyDetail' :: SchedulingPolicyDetail -> Text
arn} -> Text
arn) (\s :: SchedulingPolicyDetail
s@SchedulingPolicyDetail' {} Text
a -> SchedulingPolicyDetail
s {$sel:arn:SchedulingPolicyDetail' :: Text
arn = Text
a} :: SchedulingPolicyDetail)

instance Data.FromJSON SchedulingPolicyDetail where
  parseJSON :: Value -> Parser SchedulingPolicyDetail
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SchedulingPolicyDetail"
      ( \Object
x ->
          Maybe FairsharePolicy
-> Maybe (HashMap Text Text)
-> Text
-> Text
-> SchedulingPolicyDetail
SchedulingPolicyDetail'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"fairsharePolicy")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"tags" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"name")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"arn")
      )

instance Prelude.Hashable SchedulingPolicyDetail where
  hashWithSalt :: Int -> SchedulingPolicyDetail -> Int
hashWithSalt Int
_salt SchedulingPolicyDetail' {Maybe (HashMap Text Text)
Maybe FairsharePolicy
Text
arn :: Text
name :: Text
tags :: Maybe (HashMap Text Text)
fairsharePolicy :: Maybe FairsharePolicy
$sel:arn:SchedulingPolicyDetail' :: SchedulingPolicyDetail -> Text
$sel:name:SchedulingPolicyDetail' :: SchedulingPolicyDetail -> Text
$sel:tags:SchedulingPolicyDetail' :: SchedulingPolicyDetail -> Maybe (HashMap Text Text)
$sel:fairsharePolicy:SchedulingPolicyDetail' :: SchedulingPolicyDetail -> Maybe FairsharePolicy
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe FairsharePolicy
fairsharePolicy
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
tags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
arn

instance Prelude.NFData SchedulingPolicyDetail where
  rnf :: SchedulingPolicyDetail -> ()
rnf SchedulingPolicyDetail' {Maybe (HashMap Text Text)
Maybe FairsharePolicy
Text
arn :: Text
name :: Text
tags :: Maybe (HashMap Text Text)
fairsharePolicy :: Maybe FairsharePolicy
$sel:arn:SchedulingPolicyDetail' :: SchedulingPolicyDetail -> Text
$sel:name:SchedulingPolicyDetail' :: SchedulingPolicyDetail -> Text
$sel:tags:SchedulingPolicyDetail' :: SchedulingPolicyDetail -> Maybe (HashMap Text Text)
$sel:fairsharePolicy:SchedulingPolicyDetail' :: SchedulingPolicyDetail -> Maybe FairsharePolicy
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe FairsharePolicy
fairsharePolicy
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
tags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
arn