{-# 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.EC2.ModifyIpamScope
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Modify an IPAM scope.
module Amazonka.EC2.ModifyIpamScope
  ( -- * Creating a Request
    ModifyIpamScope (..),
    newModifyIpamScope,

    -- * Request Lenses
    modifyIpamScope_description,
    modifyIpamScope_dryRun,
    modifyIpamScope_ipamScopeId,

    -- * Destructuring the Response
    ModifyIpamScopeResponse (..),
    newModifyIpamScopeResponse,

    -- * Response Lenses
    modifyIpamScopeResponse_ipamScope,
    modifyIpamScopeResponse_httpStatus,
  )
where

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

-- | /See:/ 'newModifyIpamScope' smart constructor.
data ModifyIpamScope = ModifyIpamScope'
  { -- | The description of the scope you want to modify.
    ModifyIpamScope -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | A check for whether you have the required permissions for the action
    -- without actually making the request and provides an error response. If
    -- you have the required permissions, the error response is
    -- @DryRunOperation@. Otherwise, it is @UnauthorizedOperation@.
    ModifyIpamScope -> Maybe Bool
dryRun :: Prelude.Maybe Prelude.Bool,
    -- | The ID of the scope you want to modify.
    ModifyIpamScope -> Text
ipamScopeId :: Prelude.Text
  }
  deriving (ModifyIpamScope -> ModifyIpamScope -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ModifyIpamScope -> ModifyIpamScope -> Bool
$c/= :: ModifyIpamScope -> ModifyIpamScope -> Bool
== :: ModifyIpamScope -> ModifyIpamScope -> Bool
$c== :: ModifyIpamScope -> ModifyIpamScope -> Bool
Prelude.Eq, ReadPrec [ModifyIpamScope]
ReadPrec ModifyIpamScope
Int -> ReadS ModifyIpamScope
ReadS [ModifyIpamScope]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ModifyIpamScope]
$creadListPrec :: ReadPrec [ModifyIpamScope]
readPrec :: ReadPrec ModifyIpamScope
$creadPrec :: ReadPrec ModifyIpamScope
readList :: ReadS [ModifyIpamScope]
$creadList :: ReadS [ModifyIpamScope]
readsPrec :: Int -> ReadS ModifyIpamScope
$creadsPrec :: Int -> ReadS ModifyIpamScope
Prelude.Read, Int -> ModifyIpamScope -> ShowS
[ModifyIpamScope] -> ShowS
ModifyIpamScope -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ModifyIpamScope] -> ShowS
$cshowList :: [ModifyIpamScope] -> ShowS
show :: ModifyIpamScope -> String
$cshow :: ModifyIpamScope -> String
showsPrec :: Int -> ModifyIpamScope -> ShowS
$cshowsPrec :: Int -> ModifyIpamScope -> ShowS
Prelude.Show, forall x. Rep ModifyIpamScope x -> ModifyIpamScope
forall x. ModifyIpamScope -> Rep ModifyIpamScope x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ModifyIpamScope x -> ModifyIpamScope
$cfrom :: forall x. ModifyIpamScope -> Rep ModifyIpamScope x
Prelude.Generic)

-- |
-- Create a value of 'ModifyIpamScope' 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:
--
-- 'description', 'modifyIpamScope_description' - The description of the scope you want to modify.
--
-- 'dryRun', 'modifyIpamScope_dryRun' - A check for whether you have the required permissions for the action
-- without actually making the request and provides an error response. If
-- you have the required permissions, the error response is
-- @DryRunOperation@. Otherwise, it is @UnauthorizedOperation@.
--
-- 'ipamScopeId', 'modifyIpamScope_ipamScopeId' - The ID of the scope you want to modify.
newModifyIpamScope ::
  -- | 'ipamScopeId'
  Prelude.Text ->
  ModifyIpamScope
newModifyIpamScope :: Text -> ModifyIpamScope
newModifyIpamScope Text
pIpamScopeId_ =
  ModifyIpamScope'
    { $sel:description:ModifyIpamScope' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:dryRun:ModifyIpamScope' :: Maybe Bool
dryRun = forall a. Maybe a
Prelude.Nothing,
      $sel:ipamScopeId:ModifyIpamScope' :: Text
ipamScopeId = Text
pIpamScopeId_
    }

-- | The description of the scope you want to modify.
modifyIpamScope_description :: Lens.Lens' ModifyIpamScope (Prelude.Maybe Prelude.Text)
modifyIpamScope_description :: Lens' ModifyIpamScope (Maybe Text)
modifyIpamScope_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyIpamScope' {Maybe Text
description :: Maybe Text
$sel:description:ModifyIpamScope' :: ModifyIpamScope -> Maybe Text
description} -> Maybe Text
description) (\s :: ModifyIpamScope
s@ModifyIpamScope' {} Maybe Text
a -> ModifyIpamScope
s {$sel:description:ModifyIpamScope' :: Maybe Text
description = Maybe Text
a} :: ModifyIpamScope)

-- | A check for whether you have the required permissions for the action
-- without actually making the request and provides an error response. If
-- you have the required permissions, the error response is
-- @DryRunOperation@. Otherwise, it is @UnauthorizedOperation@.
modifyIpamScope_dryRun :: Lens.Lens' ModifyIpamScope (Prelude.Maybe Prelude.Bool)
modifyIpamScope_dryRun :: Lens' ModifyIpamScope (Maybe Bool)
modifyIpamScope_dryRun = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyIpamScope' {Maybe Bool
dryRun :: Maybe Bool
$sel:dryRun:ModifyIpamScope' :: ModifyIpamScope -> Maybe Bool
dryRun} -> Maybe Bool
dryRun) (\s :: ModifyIpamScope
s@ModifyIpamScope' {} Maybe Bool
a -> ModifyIpamScope
s {$sel:dryRun:ModifyIpamScope' :: Maybe Bool
dryRun = Maybe Bool
a} :: ModifyIpamScope)

-- | The ID of the scope you want to modify.
modifyIpamScope_ipamScopeId :: Lens.Lens' ModifyIpamScope Prelude.Text
modifyIpamScope_ipamScopeId :: Lens' ModifyIpamScope Text
modifyIpamScope_ipamScopeId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyIpamScope' {Text
ipamScopeId :: Text
$sel:ipamScopeId:ModifyIpamScope' :: ModifyIpamScope -> Text
ipamScopeId} -> Text
ipamScopeId) (\s :: ModifyIpamScope
s@ModifyIpamScope' {} Text
a -> ModifyIpamScope
s {$sel:ipamScopeId:ModifyIpamScope' :: Text
ipamScopeId = Text
a} :: ModifyIpamScope)

instance Core.AWSRequest ModifyIpamScope where
  type
    AWSResponse ModifyIpamScope =
      ModifyIpamScopeResponse
  request :: (Service -> Service) -> ModifyIpamScope -> Request ModifyIpamScope
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.postQuery (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ModifyIpamScope
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ModifyIpamScope)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXML
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe IpamScope -> Int -> ModifyIpamScopeResponse
ModifyIpamScopeResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"ipamScope")
            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 ModifyIpamScope where
  hashWithSalt :: Int -> ModifyIpamScope -> Int
hashWithSalt Int
_salt ModifyIpamScope' {Maybe Bool
Maybe Text
Text
ipamScopeId :: Text
dryRun :: Maybe Bool
description :: Maybe Text
$sel:ipamScopeId:ModifyIpamScope' :: ModifyIpamScope -> Text
$sel:dryRun:ModifyIpamScope' :: ModifyIpamScope -> Maybe Bool
$sel:description:ModifyIpamScope' :: ModifyIpamScope -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
dryRun
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
ipamScopeId

instance Prelude.NFData ModifyIpamScope where
  rnf :: ModifyIpamScope -> ()
rnf ModifyIpamScope' {Maybe Bool
Maybe Text
Text
ipamScopeId :: Text
dryRun :: Maybe Bool
description :: Maybe Text
$sel:ipamScopeId:ModifyIpamScope' :: ModifyIpamScope -> Text
$sel:dryRun:ModifyIpamScope' :: ModifyIpamScope -> Maybe Bool
$sel:description:ModifyIpamScope' :: ModifyIpamScope -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
dryRun
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
ipamScopeId

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

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

instance Data.ToQuery ModifyIpamScope where
  toQuery :: ModifyIpamScope -> QueryString
toQuery ModifyIpamScope' {Maybe Bool
Maybe Text
Text
ipamScopeId :: Text
dryRun :: Maybe Bool
description :: Maybe Text
$sel:ipamScopeId:ModifyIpamScope' :: ModifyIpamScope -> Text
$sel:dryRun:ModifyIpamScope' :: ModifyIpamScope -> Maybe Bool
$sel:description:ModifyIpamScope' :: ModifyIpamScope -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"ModifyIpamScope" :: Prelude.ByteString),
        ByteString
"Version"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2016-11-15" :: Prelude.ByteString),
        ByteString
"Description" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
description,
        ByteString
"DryRun" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Bool
dryRun,
        ByteString
"IpamScopeId" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
ipamScopeId
      ]

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

-- |
-- Create a value of 'ModifyIpamScopeResponse' 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:
--
-- 'ipamScope', 'modifyIpamScopeResponse_ipamScope' - The results of the modification.
--
-- 'httpStatus', 'modifyIpamScopeResponse_httpStatus' - The response's http status code.
newModifyIpamScopeResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ModifyIpamScopeResponse
newModifyIpamScopeResponse :: Int -> ModifyIpamScopeResponse
newModifyIpamScopeResponse Int
pHttpStatus_ =
  ModifyIpamScopeResponse'
    { $sel:ipamScope:ModifyIpamScopeResponse' :: Maybe IpamScope
ipamScope =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ModifyIpamScopeResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The results of the modification.
modifyIpamScopeResponse_ipamScope :: Lens.Lens' ModifyIpamScopeResponse (Prelude.Maybe IpamScope)
modifyIpamScopeResponse_ipamScope :: Lens' ModifyIpamScopeResponse (Maybe IpamScope)
modifyIpamScopeResponse_ipamScope = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyIpamScopeResponse' {Maybe IpamScope
ipamScope :: Maybe IpamScope
$sel:ipamScope:ModifyIpamScopeResponse' :: ModifyIpamScopeResponse -> Maybe IpamScope
ipamScope} -> Maybe IpamScope
ipamScope) (\s :: ModifyIpamScopeResponse
s@ModifyIpamScopeResponse' {} Maybe IpamScope
a -> ModifyIpamScopeResponse
s {$sel:ipamScope:ModifyIpamScopeResponse' :: Maybe IpamScope
ipamScope = Maybe IpamScope
a} :: ModifyIpamScopeResponse)

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

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