{-# 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.ChimeSdkVoice.CreateVoiceConnectorGroup
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- -- | Undocumented operation.
module Amazonka.ChimeSdkVoice.CreateVoiceConnectorGroup
  ( -- * Creating a Request
    CreateVoiceConnectorGroup (..),
    newCreateVoiceConnectorGroup,

    -- * Request Lenses
    createVoiceConnectorGroup_voiceConnectorItems,
    createVoiceConnectorGroup_name,

    -- * Destructuring the Response
    CreateVoiceConnectorGroupResponse (..),
    newCreateVoiceConnectorGroupResponse,

    -- * Response Lenses
    createVoiceConnectorGroupResponse_voiceConnectorGroup,
    createVoiceConnectorGroupResponse_httpStatus,
  )
where

import Amazonka.ChimeSdkVoice.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

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

-- |
-- Create a value of 'CreateVoiceConnectorGroup' 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:
--
-- 'voiceConnectorItems', 'createVoiceConnectorGroup_voiceConnectorItems' - Undocumented member.
--
-- 'name', 'createVoiceConnectorGroup_name' - Undocumented member.
newCreateVoiceConnectorGroup ::
  -- | 'name'
  Prelude.Text ->
  CreateVoiceConnectorGroup
newCreateVoiceConnectorGroup :: Text -> CreateVoiceConnectorGroup
newCreateVoiceConnectorGroup Text
pName_ =
  CreateVoiceConnectorGroup'
    { $sel:voiceConnectorItems:CreateVoiceConnectorGroup' :: Maybe [VoiceConnectorItem]
voiceConnectorItems =
        forall a. Maybe a
Prelude.Nothing,
      $sel:name:CreateVoiceConnectorGroup' :: Text
name = Text
pName_
    }

-- | Undocumented member.
createVoiceConnectorGroup_voiceConnectorItems :: Lens.Lens' CreateVoiceConnectorGroup (Prelude.Maybe [VoiceConnectorItem])
createVoiceConnectorGroup_voiceConnectorItems :: Lens' CreateVoiceConnectorGroup (Maybe [VoiceConnectorItem])
createVoiceConnectorGroup_voiceConnectorItems = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateVoiceConnectorGroup' {Maybe [VoiceConnectorItem]
voiceConnectorItems :: Maybe [VoiceConnectorItem]
$sel:voiceConnectorItems:CreateVoiceConnectorGroup' :: CreateVoiceConnectorGroup -> Maybe [VoiceConnectorItem]
voiceConnectorItems} -> Maybe [VoiceConnectorItem]
voiceConnectorItems) (\s :: CreateVoiceConnectorGroup
s@CreateVoiceConnectorGroup' {} Maybe [VoiceConnectorItem]
a -> CreateVoiceConnectorGroup
s {$sel:voiceConnectorItems:CreateVoiceConnectorGroup' :: Maybe [VoiceConnectorItem]
voiceConnectorItems = Maybe [VoiceConnectorItem]
a} :: CreateVoiceConnectorGroup) 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

-- | Undocumented member.
createVoiceConnectorGroup_name :: Lens.Lens' CreateVoiceConnectorGroup Prelude.Text
createVoiceConnectorGroup_name :: Lens' CreateVoiceConnectorGroup Text
createVoiceConnectorGroup_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateVoiceConnectorGroup' {Text
name :: Text
$sel:name:CreateVoiceConnectorGroup' :: CreateVoiceConnectorGroup -> Text
name} -> Text
name) (\s :: CreateVoiceConnectorGroup
s@CreateVoiceConnectorGroup' {} Text
a -> CreateVoiceConnectorGroup
s {$sel:name:CreateVoiceConnectorGroup' :: Text
name = Text
a} :: CreateVoiceConnectorGroup)

instance Core.AWSRequest CreateVoiceConnectorGroup where
  type
    AWSResponse CreateVoiceConnectorGroup =
      CreateVoiceConnectorGroupResponse
  request :: (Service -> Service)
-> CreateVoiceConnectorGroup -> Request CreateVoiceConnectorGroup
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 CreateVoiceConnectorGroup
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateVoiceConnectorGroup)))
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 ->
          Maybe VoiceConnectorGroup
-> Int -> CreateVoiceConnectorGroupResponse
CreateVoiceConnectorGroupResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"VoiceConnectorGroup")
            forall (f :: * -> *) a b. Applicative f => 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))
      )

instance Prelude.Hashable CreateVoiceConnectorGroup where
  hashWithSalt :: Int -> CreateVoiceConnectorGroup -> Int
hashWithSalt Int
_salt CreateVoiceConnectorGroup' {Maybe [VoiceConnectorItem]
Text
name :: Text
voiceConnectorItems :: Maybe [VoiceConnectorItem]
$sel:name:CreateVoiceConnectorGroup' :: CreateVoiceConnectorGroup -> Text
$sel:voiceConnectorItems:CreateVoiceConnectorGroup' :: CreateVoiceConnectorGroup -> Maybe [VoiceConnectorItem]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [VoiceConnectorItem]
voiceConnectorItems
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name

instance Prelude.NFData CreateVoiceConnectorGroup where
  rnf :: CreateVoiceConnectorGroup -> ()
rnf CreateVoiceConnectorGroup' {Maybe [VoiceConnectorItem]
Text
name :: Text
voiceConnectorItems :: Maybe [VoiceConnectorItem]
$sel:name:CreateVoiceConnectorGroup' :: CreateVoiceConnectorGroup -> Text
$sel:voiceConnectorItems:CreateVoiceConnectorGroup' :: CreateVoiceConnectorGroup -> Maybe [VoiceConnectorItem]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [VoiceConnectorItem]
voiceConnectorItems
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name

instance Data.ToHeaders CreateVoiceConnectorGroup where
  toHeaders :: CreateVoiceConnectorGroup -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

instance Data.ToJSON CreateVoiceConnectorGroup where
  toJSON :: CreateVoiceConnectorGroup -> Value
toJSON CreateVoiceConnectorGroup' {Maybe [VoiceConnectorItem]
Text
name :: Text
voiceConnectorItems :: Maybe [VoiceConnectorItem]
$sel:name:CreateVoiceConnectorGroup' :: CreateVoiceConnectorGroup -> Text
$sel:voiceConnectorItems:CreateVoiceConnectorGroup' :: CreateVoiceConnectorGroup -> Maybe [VoiceConnectorItem]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"VoiceConnectorItems" 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 [VoiceConnectorItem]
voiceConnectorItems,
            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 CreateVoiceConnectorGroup where
  toPath :: CreateVoiceConnectorGroup -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/voice-connector-groups"

instance Data.ToQuery CreateVoiceConnectorGroup where
  toQuery :: CreateVoiceConnectorGroup -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newCreateVoiceConnectorGroupResponse' smart constructor.
data CreateVoiceConnectorGroupResponse = CreateVoiceConnectorGroupResponse'
  { CreateVoiceConnectorGroupResponse -> Maybe VoiceConnectorGroup
voiceConnectorGroup :: Prelude.Maybe VoiceConnectorGroup,
    -- | The response's http status code.
    CreateVoiceConnectorGroupResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateVoiceConnectorGroupResponse
-> CreateVoiceConnectorGroupResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateVoiceConnectorGroupResponse
-> CreateVoiceConnectorGroupResponse -> Bool
$c/= :: CreateVoiceConnectorGroupResponse
-> CreateVoiceConnectorGroupResponse -> Bool
== :: CreateVoiceConnectorGroupResponse
-> CreateVoiceConnectorGroupResponse -> Bool
$c== :: CreateVoiceConnectorGroupResponse
-> CreateVoiceConnectorGroupResponse -> Bool
Prelude.Eq, ReadPrec [CreateVoiceConnectorGroupResponse]
ReadPrec CreateVoiceConnectorGroupResponse
Int -> ReadS CreateVoiceConnectorGroupResponse
ReadS [CreateVoiceConnectorGroupResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateVoiceConnectorGroupResponse]
$creadListPrec :: ReadPrec [CreateVoiceConnectorGroupResponse]
readPrec :: ReadPrec CreateVoiceConnectorGroupResponse
$creadPrec :: ReadPrec CreateVoiceConnectorGroupResponse
readList :: ReadS [CreateVoiceConnectorGroupResponse]
$creadList :: ReadS [CreateVoiceConnectorGroupResponse]
readsPrec :: Int -> ReadS CreateVoiceConnectorGroupResponse
$creadsPrec :: Int -> ReadS CreateVoiceConnectorGroupResponse
Prelude.Read, Int -> CreateVoiceConnectorGroupResponse -> ShowS
[CreateVoiceConnectorGroupResponse] -> ShowS
CreateVoiceConnectorGroupResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateVoiceConnectorGroupResponse] -> ShowS
$cshowList :: [CreateVoiceConnectorGroupResponse] -> ShowS
show :: CreateVoiceConnectorGroupResponse -> String
$cshow :: CreateVoiceConnectorGroupResponse -> String
showsPrec :: Int -> CreateVoiceConnectorGroupResponse -> ShowS
$cshowsPrec :: Int -> CreateVoiceConnectorGroupResponse -> ShowS
Prelude.Show, forall x.
Rep CreateVoiceConnectorGroupResponse x
-> CreateVoiceConnectorGroupResponse
forall x.
CreateVoiceConnectorGroupResponse
-> Rep CreateVoiceConnectorGroupResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateVoiceConnectorGroupResponse x
-> CreateVoiceConnectorGroupResponse
$cfrom :: forall x.
CreateVoiceConnectorGroupResponse
-> Rep CreateVoiceConnectorGroupResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateVoiceConnectorGroupResponse' 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:
--
-- 'voiceConnectorGroup', 'createVoiceConnectorGroupResponse_voiceConnectorGroup' - Undocumented member.
--
-- 'httpStatus', 'createVoiceConnectorGroupResponse_httpStatus' - The response's http status code.
newCreateVoiceConnectorGroupResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateVoiceConnectorGroupResponse
newCreateVoiceConnectorGroupResponse :: Int -> CreateVoiceConnectorGroupResponse
newCreateVoiceConnectorGroupResponse Int
pHttpStatus_ =
  CreateVoiceConnectorGroupResponse'
    { $sel:voiceConnectorGroup:CreateVoiceConnectorGroupResponse' :: Maybe VoiceConnectorGroup
voiceConnectorGroup =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateVoiceConnectorGroupResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Undocumented member.
createVoiceConnectorGroupResponse_voiceConnectorGroup :: Lens.Lens' CreateVoiceConnectorGroupResponse (Prelude.Maybe VoiceConnectorGroup)
createVoiceConnectorGroupResponse_voiceConnectorGroup :: Lens' CreateVoiceConnectorGroupResponse (Maybe VoiceConnectorGroup)
createVoiceConnectorGroupResponse_voiceConnectorGroup = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateVoiceConnectorGroupResponse' {Maybe VoiceConnectorGroup
voiceConnectorGroup :: Maybe VoiceConnectorGroup
$sel:voiceConnectorGroup:CreateVoiceConnectorGroupResponse' :: CreateVoiceConnectorGroupResponse -> Maybe VoiceConnectorGroup
voiceConnectorGroup} -> Maybe VoiceConnectorGroup
voiceConnectorGroup) (\s :: CreateVoiceConnectorGroupResponse
s@CreateVoiceConnectorGroupResponse' {} Maybe VoiceConnectorGroup
a -> CreateVoiceConnectorGroupResponse
s {$sel:voiceConnectorGroup:CreateVoiceConnectorGroupResponse' :: Maybe VoiceConnectorGroup
voiceConnectorGroup = Maybe VoiceConnectorGroup
a} :: CreateVoiceConnectorGroupResponse)

-- | The response's http status code.
createVoiceConnectorGroupResponse_httpStatus :: Lens.Lens' CreateVoiceConnectorGroupResponse Prelude.Int
createVoiceConnectorGroupResponse_httpStatus :: Lens' CreateVoiceConnectorGroupResponse Int
createVoiceConnectorGroupResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateVoiceConnectorGroupResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateVoiceConnectorGroupResponse' :: CreateVoiceConnectorGroupResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateVoiceConnectorGroupResponse
s@CreateVoiceConnectorGroupResponse' {} Int
a -> CreateVoiceConnectorGroupResponse
s {$sel:httpStatus:CreateVoiceConnectorGroupResponse' :: Int
httpStatus = Int
a} :: CreateVoiceConnectorGroupResponse)

instance
  Prelude.NFData
    CreateVoiceConnectorGroupResponse
  where
  rnf :: CreateVoiceConnectorGroupResponse -> ()
rnf CreateVoiceConnectorGroupResponse' {Int
Maybe VoiceConnectorGroup
httpStatus :: Int
voiceConnectorGroup :: Maybe VoiceConnectorGroup
$sel:httpStatus:CreateVoiceConnectorGroupResponse' :: CreateVoiceConnectorGroupResponse -> Int
$sel:voiceConnectorGroup:CreateVoiceConnectorGroupResponse' :: CreateVoiceConnectorGroupResponse -> Maybe VoiceConnectorGroup
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe VoiceConnectorGroup
voiceConnectorGroup
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus