{-# 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 #-}
module Amazonka.Batch.CreateSchedulingPolicy
(
CreateSchedulingPolicy (..),
newCreateSchedulingPolicy,
createSchedulingPolicy_fairsharePolicy,
createSchedulingPolicy_tags,
createSchedulingPolicy_name,
CreateSchedulingPolicyResponse (..),
newCreateSchedulingPolicyResponse,
createSchedulingPolicyResponse_httpStatus,
createSchedulingPolicyResponse_name,
createSchedulingPolicyResponse_arn,
)
where
import Amazonka.Batch.Types
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
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data CreateSchedulingPolicy = CreateSchedulingPolicy'
{
CreateSchedulingPolicy -> Maybe FairsharePolicy
fairsharePolicy :: Prelude.Maybe FairsharePolicy,
CreateSchedulingPolicy -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
CreateSchedulingPolicy -> Text
name :: Prelude.Text
}
deriving (CreateSchedulingPolicy -> CreateSchedulingPolicy -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateSchedulingPolicy -> CreateSchedulingPolicy -> Bool
$c/= :: CreateSchedulingPolicy -> CreateSchedulingPolicy -> Bool
== :: CreateSchedulingPolicy -> CreateSchedulingPolicy -> Bool
$c== :: CreateSchedulingPolicy -> CreateSchedulingPolicy -> Bool
Prelude.Eq, ReadPrec [CreateSchedulingPolicy]
ReadPrec CreateSchedulingPolicy
Int -> ReadS CreateSchedulingPolicy
ReadS [CreateSchedulingPolicy]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateSchedulingPolicy]
$creadListPrec :: ReadPrec [CreateSchedulingPolicy]
readPrec :: ReadPrec CreateSchedulingPolicy
$creadPrec :: ReadPrec CreateSchedulingPolicy
readList :: ReadS [CreateSchedulingPolicy]
$creadList :: ReadS [CreateSchedulingPolicy]
readsPrec :: Int -> ReadS CreateSchedulingPolicy
$creadsPrec :: Int -> ReadS CreateSchedulingPolicy
Prelude.Read, Int -> CreateSchedulingPolicy -> ShowS
[CreateSchedulingPolicy] -> ShowS
CreateSchedulingPolicy -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateSchedulingPolicy] -> ShowS
$cshowList :: [CreateSchedulingPolicy] -> ShowS
show :: CreateSchedulingPolicy -> String
$cshow :: CreateSchedulingPolicy -> String
showsPrec :: Int -> CreateSchedulingPolicy -> ShowS
$cshowsPrec :: Int -> CreateSchedulingPolicy -> ShowS
Prelude.Show, forall x. Rep CreateSchedulingPolicy x -> CreateSchedulingPolicy
forall x. CreateSchedulingPolicy -> Rep CreateSchedulingPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateSchedulingPolicy x -> CreateSchedulingPolicy
$cfrom :: forall x. CreateSchedulingPolicy -> Rep CreateSchedulingPolicy x
Prelude.Generic)
newCreateSchedulingPolicy ::
Prelude.Text ->
CreateSchedulingPolicy
newCreateSchedulingPolicy :: Text -> CreateSchedulingPolicy
newCreateSchedulingPolicy Text
pName_ =
CreateSchedulingPolicy'
{ $sel:fairsharePolicy:CreateSchedulingPolicy' :: Maybe FairsharePolicy
fairsharePolicy =
forall a. Maybe a
Prelude.Nothing,
$sel:tags:CreateSchedulingPolicy' :: Maybe (HashMap Text Text)
tags = forall a. Maybe a
Prelude.Nothing,
$sel:name:CreateSchedulingPolicy' :: Text
name = Text
pName_
}
createSchedulingPolicy_fairsharePolicy :: Lens.Lens' CreateSchedulingPolicy (Prelude.Maybe FairsharePolicy)
createSchedulingPolicy_fairsharePolicy :: Lens' CreateSchedulingPolicy (Maybe FairsharePolicy)
createSchedulingPolicy_fairsharePolicy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSchedulingPolicy' {Maybe FairsharePolicy
fairsharePolicy :: Maybe FairsharePolicy
$sel:fairsharePolicy:CreateSchedulingPolicy' :: CreateSchedulingPolicy -> Maybe FairsharePolicy
fairsharePolicy} -> Maybe FairsharePolicy
fairsharePolicy) (\s :: CreateSchedulingPolicy
s@CreateSchedulingPolicy' {} Maybe FairsharePolicy
a -> CreateSchedulingPolicy
s {$sel:fairsharePolicy:CreateSchedulingPolicy' :: Maybe FairsharePolicy
fairsharePolicy = Maybe FairsharePolicy
a} :: CreateSchedulingPolicy)
createSchedulingPolicy_tags :: Lens.Lens' CreateSchedulingPolicy (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createSchedulingPolicy_tags :: Lens' CreateSchedulingPolicy (Maybe (HashMap Text Text))
createSchedulingPolicy_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSchedulingPolicy' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateSchedulingPolicy' :: CreateSchedulingPolicy -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateSchedulingPolicy
s@CreateSchedulingPolicy' {} Maybe (HashMap Text Text)
a -> CreateSchedulingPolicy
s {$sel:tags:CreateSchedulingPolicy' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateSchedulingPolicy) 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
createSchedulingPolicy_name :: Lens.Lens' CreateSchedulingPolicy Prelude.Text
createSchedulingPolicy_name :: Lens' CreateSchedulingPolicy Text
createSchedulingPolicy_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSchedulingPolicy' {Text
name :: Text
$sel:name:CreateSchedulingPolicy' :: CreateSchedulingPolicy -> Text
name} -> Text
name) (\s :: CreateSchedulingPolicy
s@CreateSchedulingPolicy' {} Text
a -> CreateSchedulingPolicy
s {$sel:name:CreateSchedulingPolicy' :: Text
name = Text
a} :: CreateSchedulingPolicy)
instance Core.AWSRequest CreateSchedulingPolicy where
type
AWSResponse CreateSchedulingPolicy =
CreateSchedulingPolicyResponse
request :: (Service -> Service)
-> CreateSchedulingPolicy -> Request CreateSchedulingPolicy
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateSchedulingPolicy
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateSchedulingPolicy)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Int -> Text -> Text -> CreateSchedulingPolicyResponse
CreateSchedulingPolicyResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String 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 -> Either String a
Data..:> Key
"arn")
)
instance Prelude.Hashable CreateSchedulingPolicy where
hashWithSalt :: Int -> CreateSchedulingPolicy -> Int
hashWithSalt Int
_salt CreateSchedulingPolicy' {Maybe (HashMap Text Text)
Maybe FairsharePolicy
Text
name :: Text
tags :: Maybe (HashMap Text Text)
fairsharePolicy :: Maybe FairsharePolicy
$sel:name:CreateSchedulingPolicy' :: CreateSchedulingPolicy -> Text
$sel:tags:CreateSchedulingPolicy' :: CreateSchedulingPolicy -> Maybe (HashMap Text Text)
$sel:fairsharePolicy:CreateSchedulingPolicy' :: CreateSchedulingPolicy -> 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
instance Prelude.NFData CreateSchedulingPolicy where
rnf :: CreateSchedulingPolicy -> ()
rnf CreateSchedulingPolicy' {Maybe (HashMap Text Text)
Maybe FairsharePolicy
Text
name :: Text
tags :: Maybe (HashMap Text Text)
fairsharePolicy :: Maybe FairsharePolicy
$sel:name:CreateSchedulingPolicy' :: CreateSchedulingPolicy -> Text
$sel:tags:CreateSchedulingPolicy' :: CreateSchedulingPolicy -> Maybe (HashMap Text Text)
$sel:fairsharePolicy:CreateSchedulingPolicy' :: CreateSchedulingPolicy -> 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
instance Data.ToHeaders CreateSchedulingPolicy where
toHeaders :: CreateSchedulingPolicy -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON CreateSchedulingPolicy where
toJSON :: CreateSchedulingPolicy -> Value
toJSON CreateSchedulingPolicy' {Maybe (HashMap Text Text)
Maybe FairsharePolicy
Text
name :: Text
tags :: Maybe (HashMap Text Text)
fairsharePolicy :: Maybe FairsharePolicy
$sel:name:CreateSchedulingPolicy' :: CreateSchedulingPolicy -> Text
$sel:tags:CreateSchedulingPolicy' :: CreateSchedulingPolicy -> Maybe (HashMap Text Text)
$sel:fairsharePolicy:CreateSchedulingPolicy' :: CreateSchedulingPolicy -> Maybe FairsharePolicy
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"fairsharePolicy" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe FairsharePolicy
fairsharePolicy,
(Key
"tags" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
tags,
forall a. a -> Maybe a
Prelude.Just (Key
"name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name)
]
)
instance Data.ToPath CreateSchedulingPolicy where
toPath :: CreateSchedulingPolicy -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/v1/createschedulingpolicy"
instance Data.ToQuery CreateSchedulingPolicy where
toQuery :: CreateSchedulingPolicy -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data CreateSchedulingPolicyResponse = CreateSchedulingPolicyResponse'
{
CreateSchedulingPolicyResponse -> Int
httpStatus :: Prelude.Int,
CreateSchedulingPolicyResponse -> Text
name :: Prelude.Text,
CreateSchedulingPolicyResponse -> Text
arn :: Prelude.Text
}
deriving (CreateSchedulingPolicyResponse
-> CreateSchedulingPolicyResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateSchedulingPolicyResponse
-> CreateSchedulingPolicyResponse -> Bool
$c/= :: CreateSchedulingPolicyResponse
-> CreateSchedulingPolicyResponse -> Bool
== :: CreateSchedulingPolicyResponse
-> CreateSchedulingPolicyResponse -> Bool
$c== :: CreateSchedulingPolicyResponse
-> CreateSchedulingPolicyResponse -> Bool
Prelude.Eq, ReadPrec [CreateSchedulingPolicyResponse]
ReadPrec CreateSchedulingPolicyResponse
Int -> ReadS CreateSchedulingPolicyResponse
ReadS [CreateSchedulingPolicyResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateSchedulingPolicyResponse]
$creadListPrec :: ReadPrec [CreateSchedulingPolicyResponse]
readPrec :: ReadPrec CreateSchedulingPolicyResponse
$creadPrec :: ReadPrec CreateSchedulingPolicyResponse
readList :: ReadS [CreateSchedulingPolicyResponse]
$creadList :: ReadS [CreateSchedulingPolicyResponse]
readsPrec :: Int -> ReadS CreateSchedulingPolicyResponse
$creadsPrec :: Int -> ReadS CreateSchedulingPolicyResponse
Prelude.Read, Int -> CreateSchedulingPolicyResponse -> ShowS
[CreateSchedulingPolicyResponse] -> ShowS
CreateSchedulingPolicyResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateSchedulingPolicyResponse] -> ShowS
$cshowList :: [CreateSchedulingPolicyResponse] -> ShowS
show :: CreateSchedulingPolicyResponse -> String
$cshow :: CreateSchedulingPolicyResponse -> String
showsPrec :: Int -> CreateSchedulingPolicyResponse -> ShowS
$cshowsPrec :: Int -> CreateSchedulingPolicyResponse -> ShowS
Prelude.Show, forall x.
Rep CreateSchedulingPolicyResponse x
-> CreateSchedulingPolicyResponse
forall x.
CreateSchedulingPolicyResponse
-> Rep CreateSchedulingPolicyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateSchedulingPolicyResponse x
-> CreateSchedulingPolicyResponse
$cfrom :: forall x.
CreateSchedulingPolicyResponse
-> Rep CreateSchedulingPolicyResponse x
Prelude.Generic)
newCreateSchedulingPolicyResponse ::
Prelude.Int ->
Prelude.Text ->
Prelude.Text ->
CreateSchedulingPolicyResponse
newCreateSchedulingPolicyResponse :: Int -> Text -> Text -> CreateSchedulingPolicyResponse
newCreateSchedulingPolicyResponse
Int
pHttpStatus_
Text
pName_
Text
pArn_ =
CreateSchedulingPolicyResponse'
{ $sel:httpStatus:CreateSchedulingPolicyResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:name:CreateSchedulingPolicyResponse' :: Text
name = Text
pName_,
$sel:arn:CreateSchedulingPolicyResponse' :: Text
arn = Text
pArn_
}
createSchedulingPolicyResponse_httpStatus :: Lens.Lens' CreateSchedulingPolicyResponse Prelude.Int
createSchedulingPolicyResponse_httpStatus :: Lens' CreateSchedulingPolicyResponse Int
createSchedulingPolicyResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSchedulingPolicyResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateSchedulingPolicyResponse' :: CreateSchedulingPolicyResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateSchedulingPolicyResponse
s@CreateSchedulingPolicyResponse' {} Int
a -> CreateSchedulingPolicyResponse
s {$sel:httpStatus:CreateSchedulingPolicyResponse' :: Int
httpStatus = Int
a} :: CreateSchedulingPolicyResponse)
createSchedulingPolicyResponse_name :: Lens.Lens' CreateSchedulingPolicyResponse Prelude.Text
createSchedulingPolicyResponse_name :: Lens' CreateSchedulingPolicyResponse Text
createSchedulingPolicyResponse_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSchedulingPolicyResponse' {Text
name :: Text
$sel:name:CreateSchedulingPolicyResponse' :: CreateSchedulingPolicyResponse -> Text
name} -> Text
name) (\s :: CreateSchedulingPolicyResponse
s@CreateSchedulingPolicyResponse' {} Text
a -> CreateSchedulingPolicyResponse
s {$sel:name:CreateSchedulingPolicyResponse' :: Text
name = Text
a} :: CreateSchedulingPolicyResponse)
createSchedulingPolicyResponse_arn :: Lens.Lens' CreateSchedulingPolicyResponse Prelude.Text
createSchedulingPolicyResponse_arn :: Lens' CreateSchedulingPolicyResponse Text
createSchedulingPolicyResponse_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSchedulingPolicyResponse' {Text
arn :: Text
$sel:arn:CreateSchedulingPolicyResponse' :: CreateSchedulingPolicyResponse -> Text
arn} -> Text
arn) (\s :: CreateSchedulingPolicyResponse
s@CreateSchedulingPolicyResponse' {} Text
a -> CreateSchedulingPolicyResponse
s {$sel:arn:CreateSchedulingPolicyResponse' :: Text
arn = Text
a} :: CreateSchedulingPolicyResponse)
instance
Prelude.NFData
CreateSchedulingPolicyResponse
where
rnf :: CreateSchedulingPolicyResponse -> ()
rnf CreateSchedulingPolicyResponse' {Int
Text
arn :: Text
name :: Text
httpStatus :: Int
$sel:arn:CreateSchedulingPolicyResponse' :: CreateSchedulingPolicyResponse -> Text
$sel:name:CreateSchedulingPolicyResponse' :: CreateSchedulingPolicyResponse -> Text
$sel:httpStatus:CreateSchedulingPolicyResponse' :: CreateSchedulingPolicyResponse -> Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
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