{-# 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.DescribeAccount
-- 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)
--
-- Retrieves a list that describes the configuration of Bring Your Own
-- License (BYOL) for the specified account.
module Amazonka.WorkSpaces.DescribeAccount
  ( -- * Creating a Request
    DescribeAccount (..),
    newDescribeAccount,

    -- * Destructuring the Response
    DescribeAccountResponse (..),
    newDescribeAccountResponse,

    -- * Response Lenses
    describeAccountResponse_dedicatedTenancySupport,
    describeAccountResponse_dedicatedTenancyManagementCidrRange,
    describeAccountResponse_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:/ 'newDescribeAccount' smart constructor.
data DescribeAccount = DescribeAccount'
  {
  }
  deriving (DescribeAccount -> DescribeAccount -> Bool
(DescribeAccount -> DescribeAccount -> Bool)
-> (DescribeAccount -> DescribeAccount -> Bool)
-> Eq DescribeAccount
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeAccount -> DescribeAccount -> Bool
$c/= :: DescribeAccount -> DescribeAccount -> Bool
== :: DescribeAccount -> DescribeAccount -> Bool
$c== :: DescribeAccount -> DescribeAccount -> Bool
Prelude.Eq, ReadPrec [DescribeAccount]
ReadPrec DescribeAccount
Int -> ReadS DescribeAccount
ReadS [DescribeAccount]
(Int -> ReadS DescribeAccount)
-> ReadS [DescribeAccount]
-> ReadPrec DescribeAccount
-> ReadPrec [DescribeAccount]
-> Read DescribeAccount
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeAccount]
$creadListPrec :: ReadPrec [DescribeAccount]
readPrec :: ReadPrec DescribeAccount
$creadPrec :: ReadPrec DescribeAccount
readList :: ReadS [DescribeAccount]
$creadList :: ReadS [DescribeAccount]
readsPrec :: Int -> ReadS DescribeAccount
$creadsPrec :: Int -> ReadS DescribeAccount
Prelude.Read, Int -> DescribeAccount -> ShowS
[DescribeAccount] -> ShowS
DescribeAccount -> String
(Int -> DescribeAccount -> ShowS)
-> (DescribeAccount -> String)
-> ([DescribeAccount] -> ShowS)
-> Show DescribeAccount
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeAccount] -> ShowS
$cshowList :: [DescribeAccount] -> ShowS
show :: DescribeAccount -> String
$cshow :: DescribeAccount -> String
showsPrec :: Int -> DescribeAccount -> ShowS
$cshowsPrec :: Int -> DescribeAccount -> ShowS
Prelude.Show, (forall x. DescribeAccount -> Rep DescribeAccount x)
-> (forall x. Rep DescribeAccount x -> DescribeAccount)
-> Generic DescribeAccount
forall x. Rep DescribeAccount x -> DescribeAccount
forall x. DescribeAccount -> Rep DescribeAccount x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeAccount x -> DescribeAccount
$cfrom :: forall x. DescribeAccount -> Rep DescribeAccount x
Prelude.Generic)

-- |
-- Create a value of 'DescribeAccount' 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.
newDescribeAccount ::
  DescribeAccount
newDescribeAccount :: DescribeAccount
newDescribeAccount = DescribeAccount
DescribeAccount'

instance Core.AWSRequest DescribeAccount where
  type
    AWSResponse DescribeAccount =
      DescribeAccountResponse
  request :: DescribeAccount -> Request DescribeAccount
request = Service -> DescribeAccount -> Request DescribeAccount
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeAccount
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeAccount)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeAccount))
-> Logger
-> Service
-> Proxy DescribeAccount
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeAccount)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe DedicatedTenancySupportResultEnum
-> Maybe Text -> Int -> DescribeAccountResponse
DescribeAccountResponse'
            (Maybe DedicatedTenancySupportResultEnum
 -> Maybe Text -> Int -> DescribeAccountResponse)
-> Either String (Maybe DedicatedTenancySupportResultEnum)
-> Either String (Maybe Text -> Int -> DescribeAccountResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Text -> Either String (Maybe DedicatedTenancySupportResultEnum)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"DedicatedTenancySupport")
            Either String (Maybe Text -> Int -> DescribeAccountResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DescribeAccountResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"DedicatedTenancyManagementCidrRange")
            Either String (Int -> DescribeAccountResponse)
-> Either String Int -> Either String DescribeAccountResponse
forall (f :: * -> *) a b. Applicative f => 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 DescribeAccount

instance Prelude.NFData DescribeAccount

instance Core.ToHeaders DescribeAccount where
  toHeaders :: DescribeAccount -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeAccount -> 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.DescribeAccount" ::
                          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 DescribeAccount where
  toJSON :: DescribeAccount -> Value
toJSON = Value -> DescribeAccount -> Value
forall a b. a -> b -> a
Prelude.const (Object -> Value
Core.Object Object
forall a. Monoid a => a
Prelude.mempty)

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

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

-- | /See:/ 'newDescribeAccountResponse' smart constructor.
data DescribeAccountResponse = DescribeAccountResponse'
  { -- | The status of BYOL (whether BYOL is enabled or disabled).
    DescribeAccountResponse -> Maybe DedicatedTenancySupportResultEnum
dedicatedTenancySupport :: Prelude.Maybe DedicatedTenancySupportResultEnum,
    -- | The IP address range, specified as an IPv4 CIDR block, used for the
    -- management network interface.
    --
    -- The management network interface is connected to a secure Amazon
    -- WorkSpaces management network. It is used for interactive streaming of
    -- the WorkSpace desktop to Amazon WorkSpaces clients, and to allow Amazon
    -- WorkSpaces to manage the WorkSpace.
    DescribeAccountResponse -> Maybe Text
dedicatedTenancyManagementCidrRange :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DescribeAccountResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeAccountResponse -> DescribeAccountResponse -> Bool
(DescribeAccountResponse -> DescribeAccountResponse -> Bool)
-> (DescribeAccountResponse -> DescribeAccountResponse -> Bool)
-> Eq DescribeAccountResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeAccountResponse -> DescribeAccountResponse -> Bool
$c/= :: DescribeAccountResponse -> DescribeAccountResponse -> Bool
== :: DescribeAccountResponse -> DescribeAccountResponse -> Bool
$c== :: DescribeAccountResponse -> DescribeAccountResponse -> Bool
Prelude.Eq, ReadPrec [DescribeAccountResponse]
ReadPrec DescribeAccountResponse
Int -> ReadS DescribeAccountResponse
ReadS [DescribeAccountResponse]
(Int -> ReadS DescribeAccountResponse)
-> ReadS [DescribeAccountResponse]
-> ReadPrec DescribeAccountResponse
-> ReadPrec [DescribeAccountResponse]
-> Read DescribeAccountResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeAccountResponse]
$creadListPrec :: ReadPrec [DescribeAccountResponse]
readPrec :: ReadPrec DescribeAccountResponse
$creadPrec :: ReadPrec DescribeAccountResponse
readList :: ReadS [DescribeAccountResponse]
$creadList :: ReadS [DescribeAccountResponse]
readsPrec :: Int -> ReadS DescribeAccountResponse
$creadsPrec :: Int -> ReadS DescribeAccountResponse
Prelude.Read, Int -> DescribeAccountResponse -> ShowS
[DescribeAccountResponse] -> ShowS
DescribeAccountResponse -> String
(Int -> DescribeAccountResponse -> ShowS)
-> (DescribeAccountResponse -> String)
-> ([DescribeAccountResponse] -> ShowS)
-> Show DescribeAccountResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeAccountResponse] -> ShowS
$cshowList :: [DescribeAccountResponse] -> ShowS
show :: DescribeAccountResponse -> String
$cshow :: DescribeAccountResponse -> String
showsPrec :: Int -> DescribeAccountResponse -> ShowS
$cshowsPrec :: Int -> DescribeAccountResponse -> ShowS
Prelude.Show, (forall x.
 DescribeAccountResponse -> Rep DescribeAccountResponse x)
-> (forall x.
    Rep DescribeAccountResponse x -> DescribeAccountResponse)
-> Generic DescribeAccountResponse
forall x. Rep DescribeAccountResponse x -> DescribeAccountResponse
forall x. DescribeAccountResponse -> Rep DescribeAccountResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeAccountResponse x -> DescribeAccountResponse
$cfrom :: forall x. DescribeAccountResponse -> Rep DescribeAccountResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeAccountResponse' 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', 'describeAccountResponse_dedicatedTenancySupport' - The status of BYOL (whether BYOL is enabled or disabled).
--
-- 'dedicatedTenancyManagementCidrRange', 'describeAccountResponse_dedicatedTenancyManagementCidrRange' - The IP address range, specified as an IPv4 CIDR block, used for the
-- management network interface.
--
-- The management network interface is connected to a secure Amazon
-- WorkSpaces management network. It is used for interactive streaming of
-- the WorkSpace desktop to Amazon WorkSpaces clients, and to allow Amazon
-- WorkSpaces to manage the WorkSpace.
--
-- 'httpStatus', 'describeAccountResponse_httpStatus' - The response's http status code.
newDescribeAccountResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeAccountResponse
newDescribeAccountResponse :: Int -> DescribeAccountResponse
newDescribeAccountResponse Int
pHttpStatus_ =
  DescribeAccountResponse' :: Maybe DedicatedTenancySupportResultEnum
-> Maybe Text -> Int -> DescribeAccountResponse
DescribeAccountResponse'
    { $sel:dedicatedTenancySupport:DescribeAccountResponse' :: Maybe DedicatedTenancySupportResultEnum
dedicatedTenancySupport =
        Maybe DedicatedTenancySupportResultEnum
forall a. Maybe a
Prelude.Nothing,
      $sel:dedicatedTenancyManagementCidrRange:DescribeAccountResponse' :: Maybe Text
dedicatedTenancyManagementCidrRange =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeAccountResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The status of BYOL (whether BYOL is enabled or disabled).
describeAccountResponse_dedicatedTenancySupport :: Lens.Lens' DescribeAccountResponse (Prelude.Maybe DedicatedTenancySupportResultEnum)
describeAccountResponse_dedicatedTenancySupport :: (Maybe DedicatedTenancySupportResultEnum
 -> f (Maybe DedicatedTenancySupportResultEnum))
-> DescribeAccountResponse -> f DescribeAccountResponse
describeAccountResponse_dedicatedTenancySupport = (DescribeAccountResponse
 -> Maybe DedicatedTenancySupportResultEnum)
-> (DescribeAccountResponse
    -> Maybe DedicatedTenancySupportResultEnum
    -> DescribeAccountResponse)
-> Lens
     DescribeAccountResponse
     DescribeAccountResponse
     (Maybe DedicatedTenancySupportResultEnum)
     (Maybe DedicatedTenancySupportResultEnum)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAccountResponse' {Maybe DedicatedTenancySupportResultEnum
dedicatedTenancySupport :: Maybe DedicatedTenancySupportResultEnum
$sel:dedicatedTenancySupport:DescribeAccountResponse' :: DescribeAccountResponse -> Maybe DedicatedTenancySupportResultEnum
dedicatedTenancySupport} -> Maybe DedicatedTenancySupportResultEnum
dedicatedTenancySupport) (\s :: DescribeAccountResponse
s@DescribeAccountResponse' {} Maybe DedicatedTenancySupportResultEnum
a -> DescribeAccountResponse
s {$sel:dedicatedTenancySupport:DescribeAccountResponse' :: Maybe DedicatedTenancySupportResultEnum
dedicatedTenancySupport = Maybe DedicatedTenancySupportResultEnum
a} :: DescribeAccountResponse)

-- | The IP address range, specified as an IPv4 CIDR block, used for the
-- management network interface.
--
-- The management network interface is connected to a secure Amazon
-- WorkSpaces management network. It is used for interactive streaming of
-- the WorkSpace desktop to Amazon WorkSpaces clients, and to allow Amazon
-- WorkSpaces to manage the WorkSpace.
describeAccountResponse_dedicatedTenancyManagementCidrRange :: Lens.Lens' DescribeAccountResponse (Prelude.Maybe Prelude.Text)
describeAccountResponse_dedicatedTenancyManagementCidrRange :: (Maybe Text -> f (Maybe Text))
-> DescribeAccountResponse -> f DescribeAccountResponse
describeAccountResponse_dedicatedTenancyManagementCidrRange = (DescribeAccountResponse -> Maybe Text)
-> (DescribeAccountResponse
    -> Maybe Text -> DescribeAccountResponse)
-> Lens
     DescribeAccountResponse
     DescribeAccountResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAccountResponse' {Maybe Text
dedicatedTenancyManagementCidrRange :: Maybe Text
$sel:dedicatedTenancyManagementCidrRange:DescribeAccountResponse' :: DescribeAccountResponse -> Maybe Text
dedicatedTenancyManagementCidrRange} -> Maybe Text
dedicatedTenancyManagementCidrRange) (\s :: DescribeAccountResponse
s@DescribeAccountResponse' {} Maybe Text
a -> DescribeAccountResponse
s {$sel:dedicatedTenancyManagementCidrRange:DescribeAccountResponse' :: Maybe Text
dedicatedTenancyManagementCidrRange = Maybe Text
a} :: DescribeAccountResponse)

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

instance Prelude.NFData DescribeAccountResponse