{-# 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.Scheduler.CreateScheduleGroup
(
CreateScheduleGroup (..),
newCreateScheduleGroup,
createScheduleGroup_clientToken,
createScheduleGroup_tags,
createScheduleGroup_name,
CreateScheduleGroupResponse (..),
newCreateScheduleGroupResponse,
createScheduleGroupResponse_httpStatus,
createScheduleGroupResponse_scheduleGroupArn,
)
where
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
import Amazonka.Scheduler.Types
data CreateScheduleGroup = CreateScheduleGroup'
{
CreateScheduleGroup -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
CreateScheduleGroup -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
CreateScheduleGroup -> Text
name :: Prelude.Text
}
deriving (CreateScheduleGroup -> CreateScheduleGroup -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateScheduleGroup -> CreateScheduleGroup -> Bool
$c/= :: CreateScheduleGroup -> CreateScheduleGroup -> Bool
== :: CreateScheduleGroup -> CreateScheduleGroup -> Bool
$c== :: CreateScheduleGroup -> CreateScheduleGroup -> Bool
Prelude.Eq, ReadPrec [CreateScheduleGroup]
ReadPrec CreateScheduleGroup
Int -> ReadS CreateScheduleGroup
ReadS [CreateScheduleGroup]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateScheduleGroup]
$creadListPrec :: ReadPrec [CreateScheduleGroup]
readPrec :: ReadPrec CreateScheduleGroup
$creadPrec :: ReadPrec CreateScheduleGroup
readList :: ReadS [CreateScheduleGroup]
$creadList :: ReadS [CreateScheduleGroup]
readsPrec :: Int -> ReadS CreateScheduleGroup
$creadsPrec :: Int -> ReadS CreateScheduleGroup
Prelude.Read, Int -> CreateScheduleGroup -> ShowS
[CreateScheduleGroup] -> ShowS
CreateScheduleGroup -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateScheduleGroup] -> ShowS
$cshowList :: [CreateScheduleGroup] -> ShowS
show :: CreateScheduleGroup -> String
$cshow :: CreateScheduleGroup -> String
showsPrec :: Int -> CreateScheduleGroup -> ShowS
$cshowsPrec :: Int -> CreateScheduleGroup -> ShowS
Prelude.Show, forall x. Rep CreateScheduleGroup x -> CreateScheduleGroup
forall x. CreateScheduleGroup -> Rep CreateScheduleGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateScheduleGroup x -> CreateScheduleGroup
$cfrom :: forall x. CreateScheduleGroup -> Rep CreateScheduleGroup x
Prelude.Generic)
newCreateScheduleGroup ::
Prelude.Text ->
CreateScheduleGroup
newCreateScheduleGroup :: Text -> CreateScheduleGroup
newCreateScheduleGroup Text
pName_ =
CreateScheduleGroup'
{ $sel:clientToken:CreateScheduleGroup' :: Maybe Text
clientToken = forall a. Maybe a
Prelude.Nothing,
$sel:tags:CreateScheduleGroup' :: Maybe [Tag]
tags = forall a. Maybe a
Prelude.Nothing,
$sel:name:CreateScheduleGroup' :: Text
name = Text
pName_
}
createScheduleGroup_clientToken :: Lens.Lens' CreateScheduleGroup (Prelude.Maybe Prelude.Text)
createScheduleGroup_clientToken :: Lens' CreateScheduleGroup (Maybe Text)
createScheduleGroup_clientToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateScheduleGroup' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:CreateScheduleGroup' :: CreateScheduleGroup -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: CreateScheduleGroup
s@CreateScheduleGroup' {} Maybe Text
a -> CreateScheduleGroup
s {$sel:clientToken:CreateScheduleGroup' :: Maybe Text
clientToken = Maybe Text
a} :: CreateScheduleGroup)
createScheduleGroup_tags :: Lens.Lens' CreateScheduleGroup (Prelude.Maybe [Tag])
createScheduleGroup_tags :: Lens' CreateScheduleGroup (Maybe [Tag])
createScheduleGroup_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateScheduleGroup' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateScheduleGroup' :: CreateScheduleGroup -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateScheduleGroup
s@CreateScheduleGroup' {} Maybe [Tag]
a -> CreateScheduleGroup
s {$sel:tags:CreateScheduleGroup' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateScheduleGroup) 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
createScheduleGroup_name :: Lens.Lens' CreateScheduleGroup Prelude.Text
createScheduleGroup_name :: Lens' CreateScheduleGroup Text
createScheduleGroup_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateScheduleGroup' {Text
name :: Text
$sel:name:CreateScheduleGroup' :: CreateScheduleGroup -> Text
name} -> Text
name) (\s :: CreateScheduleGroup
s@CreateScheduleGroup' {} Text
a -> CreateScheduleGroup
s {$sel:name:CreateScheduleGroup' :: Text
name = Text
a} :: CreateScheduleGroup)
instance Core.AWSRequest CreateScheduleGroup where
type
AWSResponse CreateScheduleGroup =
CreateScheduleGroupResponse
request :: (Service -> Service)
-> CreateScheduleGroup -> Request CreateScheduleGroup
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 CreateScheduleGroup
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateScheduleGroup)))
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 -> CreateScheduleGroupResponse
CreateScheduleGroupResponse'
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
"ScheduleGroupArn")
)
instance Prelude.Hashable CreateScheduleGroup where
hashWithSalt :: Int -> CreateScheduleGroup -> Int
hashWithSalt Int
_salt CreateScheduleGroup' {Maybe [Tag]
Maybe Text
Text
name :: Text
tags :: Maybe [Tag]
clientToken :: Maybe Text
$sel:name:CreateScheduleGroup' :: CreateScheduleGroup -> Text
$sel:tags:CreateScheduleGroup' :: CreateScheduleGroup -> Maybe [Tag]
$sel:clientToken:CreateScheduleGroup' :: CreateScheduleGroup -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
clientToken
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Tag]
tags
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
instance Prelude.NFData CreateScheduleGroup where
rnf :: CreateScheduleGroup -> ()
rnf CreateScheduleGroup' {Maybe [Tag]
Maybe Text
Text
name :: Text
tags :: Maybe [Tag]
clientToken :: Maybe Text
$sel:name:CreateScheduleGroup' :: CreateScheduleGroup -> Text
$sel:tags:CreateScheduleGroup' :: CreateScheduleGroup -> Maybe [Tag]
$sel:clientToken:CreateScheduleGroup' :: CreateScheduleGroup -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
clientToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Tag]
tags
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
instance Data.ToHeaders CreateScheduleGroup where
toHeaders :: CreateScheduleGroup -> 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 CreateScheduleGroup where
toJSON :: CreateScheduleGroup -> Value
toJSON CreateScheduleGroup' {Maybe [Tag]
Maybe Text
Text
name :: Text
tags :: Maybe [Tag]
clientToken :: Maybe Text
$sel:name:CreateScheduleGroup' :: CreateScheduleGroup -> Text
$sel:tags:CreateScheduleGroup' :: CreateScheduleGroup -> Maybe [Tag]
$sel:clientToken:CreateScheduleGroup' :: CreateScheduleGroup -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"ClientToken" 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 Text
clientToken,
(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 [Tag]
tags
]
)
instance Data.ToPath CreateScheduleGroup where
toPath :: CreateScheduleGroup -> ByteString
toPath CreateScheduleGroup' {Maybe [Tag]
Maybe Text
Text
name :: Text
tags :: Maybe [Tag]
clientToken :: Maybe Text
$sel:name:CreateScheduleGroup' :: CreateScheduleGroup -> Text
$sel:tags:CreateScheduleGroup' :: CreateScheduleGroup -> Maybe [Tag]
$sel:clientToken:CreateScheduleGroup' :: CreateScheduleGroup -> Maybe Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/schedule-groups/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
name]
instance Data.ToQuery CreateScheduleGroup where
toQuery :: CreateScheduleGroup -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data CreateScheduleGroupResponse = CreateScheduleGroupResponse'
{
CreateScheduleGroupResponse -> Int
httpStatus :: Prelude.Int,
CreateScheduleGroupResponse -> Text
scheduleGroupArn :: Prelude.Text
}
deriving (CreateScheduleGroupResponse -> CreateScheduleGroupResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateScheduleGroupResponse -> CreateScheduleGroupResponse -> Bool
$c/= :: CreateScheduleGroupResponse -> CreateScheduleGroupResponse -> Bool
== :: CreateScheduleGroupResponse -> CreateScheduleGroupResponse -> Bool
$c== :: CreateScheduleGroupResponse -> CreateScheduleGroupResponse -> Bool
Prelude.Eq, ReadPrec [CreateScheduleGroupResponse]
ReadPrec CreateScheduleGroupResponse
Int -> ReadS CreateScheduleGroupResponse
ReadS [CreateScheduleGroupResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateScheduleGroupResponse]
$creadListPrec :: ReadPrec [CreateScheduleGroupResponse]
readPrec :: ReadPrec CreateScheduleGroupResponse
$creadPrec :: ReadPrec CreateScheduleGroupResponse
readList :: ReadS [CreateScheduleGroupResponse]
$creadList :: ReadS [CreateScheduleGroupResponse]
readsPrec :: Int -> ReadS CreateScheduleGroupResponse
$creadsPrec :: Int -> ReadS CreateScheduleGroupResponse
Prelude.Read, Int -> CreateScheduleGroupResponse -> ShowS
[CreateScheduleGroupResponse] -> ShowS
CreateScheduleGroupResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateScheduleGroupResponse] -> ShowS
$cshowList :: [CreateScheduleGroupResponse] -> ShowS
show :: CreateScheduleGroupResponse -> String
$cshow :: CreateScheduleGroupResponse -> String
showsPrec :: Int -> CreateScheduleGroupResponse -> ShowS
$cshowsPrec :: Int -> CreateScheduleGroupResponse -> ShowS
Prelude.Show, forall x.
Rep CreateScheduleGroupResponse x -> CreateScheduleGroupResponse
forall x.
CreateScheduleGroupResponse -> Rep CreateScheduleGroupResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateScheduleGroupResponse x -> CreateScheduleGroupResponse
$cfrom :: forall x.
CreateScheduleGroupResponse -> Rep CreateScheduleGroupResponse x
Prelude.Generic)
newCreateScheduleGroupResponse ::
Prelude.Int ->
Prelude.Text ->
CreateScheduleGroupResponse
newCreateScheduleGroupResponse :: Int -> Text -> CreateScheduleGroupResponse
newCreateScheduleGroupResponse
Int
pHttpStatus_
Text
pScheduleGroupArn_ =
CreateScheduleGroupResponse'
{ $sel:httpStatus:CreateScheduleGroupResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:scheduleGroupArn:CreateScheduleGroupResponse' :: Text
scheduleGroupArn = Text
pScheduleGroupArn_
}
createScheduleGroupResponse_httpStatus :: Lens.Lens' CreateScheduleGroupResponse Prelude.Int
createScheduleGroupResponse_httpStatus :: Lens' CreateScheduleGroupResponse Int
createScheduleGroupResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateScheduleGroupResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateScheduleGroupResponse' :: CreateScheduleGroupResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateScheduleGroupResponse
s@CreateScheduleGroupResponse' {} Int
a -> CreateScheduleGroupResponse
s {$sel:httpStatus:CreateScheduleGroupResponse' :: Int
httpStatus = Int
a} :: CreateScheduleGroupResponse)
createScheduleGroupResponse_scheduleGroupArn :: Lens.Lens' CreateScheduleGroupResponse Prelude.Text
createScheduleGroupResponse_scheduleGroupArn :: Lens' CreateScheduleGroupResponse Text
createScheduleGroupResponse_scheduleGroupArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateScheduleGroupResponse' {Text
scheduleGroupArn :: Text
$sel:scheduleGroupArn:CreateScheduleGroupResponse' :: CreateScheduleGroupResponse -> Text
scheduleGroupArn} -> Text
scheduleGroupArn) (\s :: CreateScheduleGroupResponse
s@CreateScheduleGroupResponse' {} Text
a -> CreateScheduleGroupResponse
s {$sel:scheduleGroupArn:CreateScheduleGroupResponse' :: Text
scheduleGroupArn = Text
a} :: CreateScheduleGroupResponse)
instance Prelude.NFData CreateScheduleGroupResponse where
rnf :: CreateScheduleGroupResponse -> ()
rnf CreateScheduleGroupResponse' {Int
Text
scheduleGroupArn :: Text
httpStatus :: Int
$sel:scheduleGroupArn:CreateScheduleGroupResponse' :: CreateScheduleGroupResponse -> Text
$sel:httpStatus:CreateScheduleGroupResponse' :: CreateScheduleGroupResponse -> 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
scheduleGroupArn