{-# 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.WorkSpaces.DeleteIpGroup
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Deletes the specified IP access control group.
--
-- You cannot delete an IP access control group that is associated with a
-- directory.
module Amazonka.WorkSpaces.DeleteIpGroup
  ( -- * Creating a Request
    DeleteIpGroup (..),
    newDeleteIpGroup,

    -- * Request Lenses
    deleteIpGroup_groupId,

    -- * Destructuring the Response
    DeleteIpGroupResponse (..),
    newDeleteIpGroupResponse,

    -- * Response Lenses
    deleteIpGroupResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.WorkSpaces.Types

-- | /See:/ 'newDeleteIpGroup' smart constructor.
data DeleteIpGroup = DeleteIpGroup'
  { -- | The identifier of the IP access control group.
    DeleteIpGroup -> Text
groupId :: Prelude.Text
  }
  deriving (DeleteIpGroup -> DeleteIpGroup -> Bool
(DeleteIpGroup -> DeleteIpGroup -> Bool)
-> (DeleteIpGroup -> DeleteIpGroup -> Bool) -> Eq DeleteIpGroup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteIpGroup -> DeleteIpGroup -> Bool
$c/= :: DeleteIpGroup -> DeleteIpGroup -> Bool
== :: DeleteIpGroup -> DeleteIpGroup -> Bool
$c== :: DeleteIpGroup -> DeleteIpGroup -> Bool
Prelude.Eq, ReadPrec [DeleteIpGroup]
ReadPrec DeleteIpGroup
Int -> ReadS DeleteIpGroup
ReadS [DeleteIpGroup]
(Int -> ReadS DeleteIpGroup)
-> ReadS [DeleteIpGroup]
-> ReadPrec DeleteIpGroup
-> ReadPrec [DeleteIpGroup]
-> Read DeleteIpGroup
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteIpGroup]
$creadListPrec :: ReadPrec [DeleteIpGroup]
readPrec :: ReadPrec DeleteIpGroup
$creadPrec :: ReadPrec DeleteIpGroup
readList :: ReadS [DeleteIpGroup]
$creadList :: ReadS [DeleteIpGroup]
readsPrec :: Int -> ReadS DeleteIpGroup
$creadsPrec :: Int -> ReadS DeleteIpGroup
Prelude.Read, Int -> DeleteIpGroup -> ShowS
[DeleteIpGroup] -> ShowS
DeleteIpGroup -> String
(Int -> DeleteIpGroup -> ShowS)
-> (DeleteIpGroup -> String)
-> ([DeleteIpGroup] -> ShowS)
-> Show DeleteIpGroup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteIpGroup] -> ShowS
$cshowList :: [DeleteIpGroup] -> ShowS
show :: DeleteIpGroup -> String
$cshow :: DeleteIpGroup -> String
showsPrec :: Int -> DeleteIpGroup -> ShowS
$cshowsPrec :: Int -> DeleteIpGroup -> ShowS
Prelude.Show, (forall x. DeleteIpGroup -> Rep DeleteIpGroup x)
-> (forall x. Rep DeleteIpGroup x -> DeleteIpGroup)
-> Generic DeleteIpGroup
forall x. Rep DeleteIpGroup x -> DeleteIpGroup
forall x. DeleteIpGroup -> Rep DeleteIpGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteIpGroup x -> DeleteIpGroup
$cfrom :: forall x. DeleteIpGroup -> Rep DeleteIpGroup x
Prelude.Generic)

-- |
-- Create a value of 'DeleteIpGroup' 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:
--
-- 'groupId', 'deleteIpGroup_groupId' - The identifier of the IP access control group.
newDeleteIpGroup ::
  -- | 'groupId'
  Prelude.Text ->
  DeleteIpGroup
newDeleteIpGroup :: Text -> DeleteIpGroup
newDeleteIpGroup Text
pGroupId_ =
  DeleteIpGroup' :: Text -> DeleteIpGroup
DeleteIpGroup' {$sel:groupId:DeleteIpGroup' :: Text
groupId = Text
pGroupId_}

-- | The identifier of the IP access control group.
deleteIpGroup_groupId :: Lens.Lens' DeleteIpGroup Prelude.Text
deleteIpGroup_groupId :: (Text -> f Text) -> DeleteIpGroup -> f DeleteIpGroup
deleteIpGroup_groupId = (DeleteIpGroup -> Text)
-> (DeleteIpGroup -> Text -> DeleteIpGroup)
-> Lens DeleteIpGroup DeleteIpGroup Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteIpGroup' {Text
groupId :: Text
$sel:groupId:DeleteIpGroup' :: DeleteIpGroup -> Text
groupId} -> Text
groupId) (\s :: DeleteIpGroup
s@DeleteIpGroup' {} Text
a -> DeleteIpGroup
s {$sel:groupId:DeleteIpGroup' :: Text
groupId = Text
a} :: DeleteIpGroup)

instance Core.AWSRequest DeleteIpGroup where
  type
    AWSResponse DeleteIpGroup =
      DeleteIpGroupResponse
  request :: DeleteIpGroup -> Request DeleteIpGroup
request = Service -> DeleteIpGroup -> Request DeleteIpGroup
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteIpGroup
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteIpGroup)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteIpGroup))
-> Logger
-> Service
-> Proxy DeleteIpGroup
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteIpGroup)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeleteIpGroupResponse
DeleteIpGroupResponse'
            (Int -> DeleteIpGroupResponse)
-> Either String Int -> Either String DeleteIpGroupResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DeleteIpGroup

instance Prelude.NFData DeleteIpGroup

instance Core.ToHeaders DeleteIpGroup where
  toHeaders :: DeleteIpGroup -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteIpGroup -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"WorkspacesService.DeleteIpGroup" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON DeleteIpGroup where
  toJSON :: DeleteIpGroup -> Value
toJSON DeleteIpGroup' {Text
groupId :: Text
$sel:groupId:DeleteIpGroup' :: DeleteIpGroup -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"GroupId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
groupId)]
      )

instance Core.ToPath DeleteIpGroup where
  toPath :: DeleteIpGroup -> ByteString
toPath = ByteString -> DeleteIpGroup -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

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

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

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

instance Prelude.NFData DeleteIpGroupResponse