{-# 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.ModifyAccount
-- 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)
--
-- Modifies the configuration of Bring Your Own License (BYOL) for the
-- specified account.
module Amazonka.WorkSpaces.ModifyAccount
  ( -- * Creating a Request
    ModifyAccount (..),
    newModifyAccount,

    -- * Request Lenses
    modifyAccount_dedicatedTenancySupport,
    modifyAccount_dedicatedTenancyManagementCidrRange,

    -- * Destructuring the Response
    ModifyAccountResponse (..),
    newModifyAccountResponse,

    -- * Response Lenses
    modifyAccountResponse_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:/ 'newModifyAccount' smart constructor.
data ModifyAccount = ModifyAccount'
  { -- | The status of BYOL.
    ModifyAccount -> Maybe DedicatedTenancySupportEnum
dedicatedTenancySupport :: Prelude.Maybe DedicatedTenancySupportEnum,
    -- | The IP address range, specified as an IPv4 CIDR block, for the
    -- management network interface. Specify an IP address range that is
    -- compatible with your network and in CIDR notation (that is, specify the
    -- range as an IPv4 CIDR block). The CIDR block size must be \/16 (for
    -- example, 203.0.113.25\/16). It must also be specified as available by
    -- the @ListAvailableManagementCidrRanges@ operation.
    ModifyAccount -> Maybe Text
dedicatedTenancyManagementCidrRange :: Prelude.Maybe Prelude.Text
  }
  deriving (ModifyAccount -> ModifyAccount -> Bool
(ModifyAccount -> ModifyAccount -> Bool)
-> (ModifyAccount -> ModifyAccount -> Bool) -> Eq ModifyAccount
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ModifyAccount -> ModifyAccount -> Bool
$c/= :: ModifyAccount -> ModifyAccount -> Bool
== :: ModifyAccount -> ModifyAccount -> Bool
$c== :: ModifyAccount -> ModifyAccount -> Bool
Prelude.Eq, ReadPrec [ModifyAccount]
ReadPrec ModifyAccount
Int -> ReadS ModifyAccount
ReadS [ModifyAccount]
(Int -> ReadS ModifyAccount)
-> ReadS [ModifyAccount]
-> ReadPrec ModifyAccount
-> ReadPrec [ModifyAccount]
-> Read ModifyAccount
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ModifyAccount]
$creadListPrec :: ReadPrec [ModifyAccount]
readPrec :: ReadPrec ModifyAccount
$creadPrec :: ReadPrec ModifyAccount
readList :: ReadS [ModifyAccount]
$creadList :: ReadS [ModifyAccount]
readsPrec :: Int -> ReadS ModifyAccount
$creadsPrec :: Int -> ReadS ModifyAccount
Prelude.Read, Int -> ModifyAccount -> ShowS
[ModifyAccount] -> ShowS
ModifyAccount -> String
(Int -> ModifyAccount -> ShowS)
-> (ModifyAccount -> String)
-> ([ModifyAccount] -> ShowS)
-> Show ModifyAccount
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ModifyAccount] -> ShowS
$cshowList :: [ModifyAccount] -> ShowS
show :: ModifyAccount -> String
$cshow :: ModifyAccount -> String
showsPrec :: Int -> ModifyAccount -> ShowS
$cshowsPrec :: Int -> ModifyAccount -> ShowS
Prelude.Show, (forall x. ModifyAccount -> Rep ModifyAccount x)
-> (forall x. Rep ModifyAccount x -> ModifyAccount)
-> Generic ModifyAccount
forall x. Rep ModifyAccount x -> ModifyAccount
forall x. ModifyAccount -> Rep ModifyAccount x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ModifyAccount x -> ModifyAccount
$cfrom :: forall x. ModifyAccount -> Rep ModifyAccount x
Prelude.Generic)

-- |
-- Create a value of 'ModifyAccount' 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:
--
-- 'dedicatedTenancySupport', 'modifyAccount_dedicatedTenancySupport' - The status of BYOL.
--
-- 'dedicatedTenancyManagementCidrRange', 'modifyAccount_dedicatedTenancyManagementCidrRange' - The IP address range, specified as an IPv4 CIDR block, for the
-- management network interface. Specify an IP address range that is
-- compatible with your network and in CIDR notation (that is, specify the
-- range as an IPv4 CIDR block). The CIDR block size must be \/16 (for
-- example, 203.0.113.25\/16). It must also be specified as available by
-- the @ListAvailableManagementCidrRanges@ operation.
newModifyAccount ::
  ModifyAccount
newModifyAccount :: ModifyAccount
newModifyAccount =
  ModifyAccount' :: Maybe DedicatedTenancySupportEnum -> Maybe Text -> ModifyAccount
ModifyAccount'
    { $sel:dedicatedTenancySupport:ModifyAccount' :: Maybe DedicatedTenancySupportEnum
dedicatedTenancySupport =
        Maybe DedicatedTenancySupportEnum
forall a. Maybe a
Prelude.Nothing,
      $sel:dedicatedTenancyManagementCidrRange:ModifyAccount' :: Maybe Text
dedicatedTenancyManagementCidrRange =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The status of BYOL.
modifyAccount_dedicatedTenancySupport :: Lens.Lens' ModifyAccount (Prelude.Maybe DedicatedTenancySupportEnum)
modifyAccount_dedicatedTenancySupport :: (Maybe DedicatedTenancySupportEnum
 -> f (Maybe DedicatedTenancySupportEnum))
-> ModifyAccount -> f ModifyAccount
modifyAccount_dedicatedTenancySupport = (ModifyAccount -> Maybe DedicatedTenancySupportEnum)
-> (ModifyAccount
    -> Maybe DedicatedTenancySupportEnum -> ModifyAccount)
-> Lens
     ModifyAccount
     ModifyAccount
     (Maybe DedicatedTenancySupportEnum)
     (Maybe DedicatedTenancySupportEnum)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyAccount' {Maybe DedicatedTenancySupportEnum
dedicatedTenancySupport :: Maybe DedicatedTenancySupportEnum
$sel:dedicatedTenancySupport:ModifyAccount' :: ModifyAccount -> Maybe DedicatedTenancySupportEnum
dedicatedTenancySupport} -> Maybe DedicatedTenancySupportEnum
dedicatedTenancySupport) (\s :: ModifyAccount
s@ModifyAccount' {} Maybe DedicatedTenancySupportEnum
a -> ModifyAccount
s {$sel:dedicatedTenancySupport:ModifyAccount' :: Maybe DedicatedTenancySupportEnum
dedicatedTenancySupport = Maybe DedicatedTenancySupportEnum
a} :: ModifyAccount)

-- | The IP address range, specified as an IPv4 CIDR block, for the
-- management network interface. Specify an IP address range that is
-- compatible with your network and in CIDR notation (that is, specify the
-- range as an IPv4 CIDR block). The CIDR block size must be \/16 (for
-- example, 203.0.113.25\/16). It must also be specified as available by
-- the @ListAvailableManagementCidrRanges@ operation.
modifyAccount_dedicatedTenancyManagementCidrRange :: Lens.Lens' ModifyAccount (Prelude.Maybe Prelude.Text)
modifyAccount_dedicatedTenancyManagementCidrRange :: (Maybe Text -> f (Maybe Text)) -> ModifyAccount -> f ModifyAccount
modifyAccount_dedicatedTenancyManagementCidrRange = (ModifyAccount -> Maybe Text)
-> (ModifyAccount -> Maybe Text -> ModifyAccount)
-> Lens ModifyAccount ModifyAccount (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyAccount' {Maybe Text
dedicatedTenancyManagementCidrRange :: Maybe Text
$sel:dedicatedTenancyManagementCidrRange:ModifyAccount' :: ModifyAccount -> Maybe Text
dedicatedTenancyManagementCidrRange} -> Maybe Text
dedicatedTenancyManagementCidrRange) (\s :: ModifyAccount
s@ModifyAccount' {} Maybe Text
a -> ModifyAccount
s {$sel:dedicatedTenancyManagementCidrRange:ModifyAccount' :: Maybe Text
dedicatedTenancyManagementCidrRange = Maybe Text
a} :: ModifyAccount)

instance Core.AWSRequest ModifyAccount where
  type
    AWSResponse ModifyAccount =
      ModifyAccountResponse
  request :: ModifyAccount -> Request ModifyAccount
request = Service -> ModifyAccount -> Request ModifyAccount
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ModifyAccount
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ModifyAccount)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse ModifyAccount))
-> Logger
-> Service
-> Proxy ModifyAccount
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ModifyAccount)))
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 -> ModifyAccountResponse
ModifyAccountResponse'
            (Int -> ModifyAccountResponse)
-> Either String Int -> Either String ModifyAccountResponse
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 ModifyAccount

instance Prelude.NFData ModifyAccount

instance Core.ToHeaders ModifyAccount where
  toHeaders :: ModifyAccount -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ModifyAccount -> 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.ModifyAccount" ::
                          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 ModifyAccount where
  toJSON :: ModifyAccount -> Value
toJSON ModifyAccount' {Maybe Text
Maybe DedicatedTenancySupportEnum
dedicatedTenancyManagementCidrRange :: Maybe Text
dedicatedTenancySupport :: Maybe DedicatedTenancySupportEnum
$sel:dedicatedTenancyManagementCidrRange:ModifyAccount' :: ModifyAccount -> Maybe Text
$sel:dedicatedTenancySupport:ModifyAccount' :: ModifyAccount -> Maybe DedicatedTenancySupportEnum
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"DedicatedTenancySupport" Text -> DedicatedTenancySupportEnum -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (DedicatedTenancySupportEnum -> Pair)
-> Maybe DedicatedTenancySupportEnum -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe DedicatedTenancySupportEnum
dedicatedTenancySupport,
            (Text
"DedicatedTenancyManagementCidrRange" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
dedicatedTenancyManagementCidrRange
          ]
      )

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

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

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

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

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

instance Prelude.NFData ModifyAccountResponse