{-# 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.IoTWireless.AssociateMulticastGroupWithFuotaTask
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Associate a multicast group with a FUOTA task.
module Amazonka.IoTWireless.AssociateMulticastGroupWithFuotaTask
  ( -- * Creating a Request
    AssociateMulticastGroupWithFuotaTask (..),
    newAssociateMulticastGroupWithFuotaTask,

    -- * Request Lenses
    associateMulticastGroupWithFuotaTask_id,
    associateMulticastGroupWithFuotaTask_multicastGroupId,

    -- * Destructuring the Response
    AssociateMulticastGroupWithFuotaTaskResponse (..),
    newAssociateMulticastGroupWithFuotaTaskResponse,

    -- * Response Lenses
    associateMulticastGroupWithFuotaTaskResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IoTWireless.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

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

-- |
-- Create a value of 'AssociateMulticastGroupWithFuotaTask' 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:
--
-- 'id', 'associateMulticastGroupWithFuotaTask_id' - Undocumented member.
--
-- 'multicastGroupId', 'associateMulticastGroupWithFuotaTask_multicastGroupId' - Undocumented member.
newAssociateMulticastGroupWithFuotaTask ::
  -- | 'id'
  Prelude.Text ->
  -- | 'multicastGroupId'
  Prelude.Text ->
  AssociateMulticastGroupWithFuotaTask
newAssociateMulticastGroupWithFuotaTask :: Text -> Text -> AssociateMulticastGroupWithFuotaTask
newAssociateMulticastGroupWithFuotaTask
  Text
pId_
  Text
pMulticastGroupId_ =
    AssociateMulticastGroupWithFuotaTask'
      { $sel:id:AssociateMulticastGroupWithFuotaTask' :: Text
id = Text
pId_,
        $sel:multicastGroupId:AssociateMulticastGroupWithFuotaTask' :: Text
multicastGroupId = Text
pMulticastGroupId_
      }

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

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

instance
  Core.AWSRequest
    AssociateMulticastGroupWithFuotaTask
  where
  type
    AWSResponse AssociateMulticastGroupWithFuotaTask =
      AssociateMulticastGroupWithFuotaTaskResponse
  request :: (Service -> Service)
-> AssociateMulticastGroupWithFuotaTask
-> Request AssociateMulticastGroupWithFuotaTask
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy AssociateMulticastGroupWithFuotaTask
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse AssociateMulticastGroupWithFuotaTask)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> AssociateMulticastGroupWithFuotaTaskResponse
AssociateMulticastGroupWithFuotaTaskResponse'
            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))
      )

instance
  Prelude.Hashable
    AssociateMulticastGroupWithFuotaTask
  where
  hashWithSalt :: Int -> AssociateMulticastGroupWithFuotaTask -> Int
hashWithSalt
    Int
_salt
    AssociateMulticastGroupWithFuotaTask' {Text
multicastGroupId :: Text
id :: Text
$sel:multicastGroupId:AssociateMulticastGroupWithFuotaTask' :: AssociateMulticastGroupWithFuotaTask -> Text
$sel:id:AssociateMulticastGroupWithFuotaTask' :: AssociateMulticastGroupWithFuotaTask -> Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
id
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
multicastGroupId

instance
  Prelude.NFData
    AssociateMulticastGroupWithFuotaTask
  where
  rnf :: AssociateMulticastGroupWithFuotaTask -> ()
rnf AssociateMulticastGroupWithFuotaTask' {Text
multicastGroupId :: Text
id :: Text
$sel:multicastGroupId:AssociateMulticastGroupWithFuotaTask' :: AssociateMulticastGroupWithFuotaTask -> Text
$sel:id:AssociateMulticastGroupWithFuotaTask' :: AssociateMulticastGroupWithFuotaTask -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
id
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
multicastGroupId

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

instance
  Data.ToJSON
    AssociateMulticastGroupWithFuotaTask
  where
  toJSON :: AssociateMulticastGroupWithFuotaTask -> Value
toJSON AssociateMulticastGroupWithFuotaTask' {Text
multicastGroupId :: Text
id :: Text
$sel:multicastGroupId:AssociateMulticastGroupWithFuotaTask' :: AssociateMulticastGroupWithFuotaTask -> Text
$sel:id:AssociateMulticastGroupWithFuotaTask' :: AssociateMulticastGroupWithFuotaTask -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"MulticastGroupId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
multicastGroupId)
          ]
      )

instance
  Data.ToPath
    AssociateMulticastGroupWithFuotaTask
  where
  toPath :: AssociateMulticastGroupWithFuotaTask -> ByteString
toPath AssociateMulticastGroupWithFuotaTask' {Text
multicastGroupId :: Text
id :: Text
$sel:multicastGroupId:AssociateMulticastGroupWithFuotaTask' :: AssociateMulticastGroupWithFuotaTask -> Text
$sel:id:AssociateMulticastGroupWithFuotaTask' :: AssociateMulticastGroupWithFuotaTask -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/fuota-tasks/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
id, ByteString
"/multicast-group"]

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

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

-- |
-- Create a value of 'AssociateMulticastGroupWithFuotaTaskResponse' 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:
--
-- 'httpStatus', 'associateMulticastGroupWithFuotaTaskResponse_httpStatus' - The response's http status code.
newAssociateMulticastGroupWithFuotaTaskResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  AssociateMulticastGroupWithFuotaTaskResponse
newAssociateMulticastGroupWithFuotaTaskResponse :: Int -> AssociateMulticastGroupWithFuotaTaskResponse
newAssociateMulticastGroupWithFuotaTaskResponse
  Int
pHttpStatus_ =
    AssociateMulticastGroupWithFuotaTaskResponse'
      { $sel:httpStatus:AssociateMulticastGroupWithFuotaTaskResponse' :: Int
httpStatus =
          Int
pHttpStatus_
      }

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

instance
  Prelude.NFData
    AssociateMulticastGroupWithFuotaTaskResponse
  where
  rnf :: AssociateMulticastGroupWithFuotaTaskResponse -> ()
rnf AssociateMulticastGroupWithFuotaTaskResponse' {Int
httpStatus :: Int
$sel:httpStatus:AssociateMulticastGroupWithFuotaTaskResponse' :: AssociateMulticastGroupWithFuotaTaskResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus