{-# 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.GlobalAccelerator.CreateAccelerator
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Create an accelerator. An accelerator includes one or more listeners
-- that process inbound connections and direct traffic to one or more
-- endpoint groups, each of which includes endpoints, such as Network Load
-- Balancers.
--
-- Global Accelerator is a global service that supports endpoints in
-- multiple Amazon Web Services Regions but you must specify the US West
-- (Oregon) Region to create, update, or otherwise work with accelerators.
-- That is, for example, specify @--region us-west-2@ on AWS CLI commands.
module Amazonka.GlobalAccelerator.CreateAccelerator
  ( -- * Creating a Request
    CreateAccelerator (..),
    newCreateAccelerator,

    -- * Request Lenses
    createAccelerator_enabled,
    createAccelerator_ipAddressType,
    createAccelerator_ipAddresses,
    createAccelerator_tags,
    createAccelerator_name,
    createAccelerator_idempotencyToken,

    -- * Destructuring the Response
    CreateAcceleratorResponse (..),
    newCreateAcceleratorResponse,

    -- * Response Lenses
    createAcceleratorResponse_accelerator,
    createAcceleratorResponse_httpStatus,
  )
where

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

-- | /See:/ 'newCreateAccelerator' smart constructor.
data CreateAccelerator = CreateAccelerator'
  { -- | Indicates whether an accelerator is enabled. The value is true or false.
    -- The default value is true.
    --
    -- If the value is set to true, an accelerator cannot be deleted. If set to
    -- false, the accelerator can be deleted.
    CreateAccelerator -> Maybe Bool
enabled :: Prelude.Maybe Prelude.Bool,
    -- | The IP address type that an accelerator supports. For a standard
    -- accelerator, the value can be IPV4 or DUAL_STACK.
    CreateAccelerator -> Maybe IpAddressType
ipAddressType :: Prelude.Maybe IpAddressType,
    -- | Optionally, if you\'ve added your own IP address pool to Global
    -- Accelerator (BYOIP), you can choose an IPv4 address from your own pool
    -- to use for the accelerator\'s static IPv4 address when you create an
    -- accelerator.
    --
    -- After you bring an address range to Amazon Web Services, it appears in
    -- your account as an address pool. When you create an accelerator, you can
    -- assign one IPv4 address from your range to it. Global Accelerator
    -- assigns you a second static IPv4 address from an Amazon IP address
    -- range. If you bring two IPv4 address ranges to Amazon Web Services, you
    -- can assign one IPv4 address from each range to your accelerator. This
    -- restriction is because Global Accelerator assigns each address range to
    -- a different network zone, for high availability.
    --
    -- You can specify one or two addresses, separated by a space. Do not
    -- include the \/32 suffix.
    --
    -- Note that you can\'t update IP addresses for an existing accelerator. To
    -- change them, you must create a new accelerator with the new addresses.
    --
    -- For more information, see
    -- <https://docs.aws.amazon.com/global-accelerator/latest/dg/using-byoip.html Bring your own IP addresses (BYOIP)>
    -- in the /Global Accelerator Developer Guide/.
    CreateAccelerator -> Maybe [Text]
ipAddresses :: Prelude.Maybe [Prelude.Text],
    -- | Create tags for an accelerator.
    --
    -- For more information, see
    -- <https://docs.aws.amazon.com/global-accelerator/latest/dg/tagging-in-global-accelerator.html Tagging in Global Accelerator>
    -- in the /Global Accelerator Developer Guide/.
    CreateAccelerator -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | The name of the accelerator. The name can have a maximum of 64
    -- characters, must contain only alphanumeric characters, periods (.), or
    -- hyphens (-), and must not begin or end with a hyphen or period.
    CreateAccelerator -> Text
name :: Prelude.Text,
    -- | A unique, case-sensitive identifier that you provide to ensure the
    -- idempotency—that is, the uniqueness—of an accelerator.
    CreateAccelerator -> Text
idempotencyToken :: Prelude.Text
  }
  deriving (CreateAccelerator -> CreateAccelerator -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateAccelerator -> CreateAccelerator -> Bool
$c/= :: CreateAccelerator -> CreateAccelerator -> Bool
== :: CreateAccelerator -> CreateAccelerator -> Bool
$c== :: CreateAccelerator -> CreateAccelerator -> Bool
Prelude.Eq, ReadPrec [CreateAccelerator]
ReadPrec CreateAccelerator
Int -> ReadS CreateAccelerator
ReadS [CreateAccelerator]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateAccelerator]
$creadListPrec :: ReadPrec [CreateAccelerator]
readPrec :: ReadPrec CreateAccelerator
$creadPrec :: ReadPrec CreateAccelerator
readList :: ReadS [CreateAccelerator]
$creadList :: ReadS [CreateAccelerator]
readsPrec :: Int -> ReadS CreateAccelerator
$creadsPrec :: Int -> ReadS CreateAccelerator
Prelude.Read, Int -> CreateAccelerator -> ShowS
[CreateAccelerator] -> ShowS
CreateAccelerator -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateAccelerator] -> ShowS
$cshowList :: [CreateAccelerator] -> ShowS
show :: CreateAccelerator -> String
$cshow :: CreateAccelerator -> String
showsPrec :: Int -> CreateAccelerator -> ShowS
$cshowsPrec :: Int -> CreateAccelerator -> ShowS
Prelude.Show, forall x. Rep CreateAccelerator x -> CreateAccelerator
forall x. CreateAccelerator -> Rep CreateAccelerator x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateAccelerator x -> CreateAccelerator
$cfrom :: forall x. CreateAccelerator -> Rep CreateAccelerator x
Prelude.Generic)

-- |
-- Create a value of 'CreateAccelerator' 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:
--
-- 'enabled', 'createAccelerator_enabled' - Indicates whether an accelerator is enabled. The value is true or false.
-- The default value is true.
--
-- If the value is set to true, an accelerator cannot be deleted. If set to
-- false, the accelerator can be deleted.
--
-- 'ipAddressType', 'createAccelerator_ipAddressType' - The IP address type that an accelerator supports. For a standard
-- accelerator, the value can be IPV4 or DUAL_STACK.
--
-- 'ipAddresses', 'createAccelerator_ipAddresses' - Optionally, if you\'ve added your own IP address pool to Global
-- Accelerator (BYOIP), you can choose an IPv4 address from your own pool
-- to use for the accelerator\'s static IPv4 address when you create an
-- accelerator.
--
-- After you bring an address range to Amazon Web Services, it appears in
-- your account as an address pool. When you create an accelerator, you can
-- assign one IPv4 address from your range to it. Global Accelerator
-- assigns you a second static IPv4 address from an Amazon IP address
-- range. If you bring two IPv4 address ranges to Amazon Web Services, you
-- can assign one IPv4 address from each range to your accelerator. This
-- restriction is because Global Accelerator assigns each address range to
-- a different network zone, for high availability.
--
-- You can specify one or two addresses, separated by a space. Do not
-- include the \/32 suffix.
--
-- Note that you can\'t update IP addresses for an existing accelerator. To
-- change them, you must create a new accelerator with the new addresses.
--
-- For more information, see
-- <https://docs.aws.amazon.com/global-accelerator/latest/dg/using-byoip.html Bring your own IP addresses (BYOIP)>
-- in the /Global Accelerator Developer Guide/.
--
-- 'tags', 'createAccelerator_tags' - Create tags for an accelerator.
--
-- For more information, see
-- <https://docs.aws.amazon.com/global-accelerator/latest/dg/tagging-in-global-accelerator.html Tagging in Global Accelerator>
-- in the /Global Accelerator Developer Guide/.
--
-- 'name', 'createAccelerator_name' - The name of the accelerator. The name can have a maximum of 64
-- characters, must contain only alphanumeric characters, periods (.), or
-- hyphens (-), and must not begin or end with a hyphen or period.
--
-- 'idempotencyToken', 'createAccelerator_idempotencyToken' - A unique, case-sensitive identifier that you provide to ensure the
-- idempotency—that is, the uniqueness—of an accelerator.
newCreateAccelerator ::
  -- | 'name'
  Prelude.Text ->
  -- | 'idempotencyToken'
  Prelude.Text ->
  CreateAccelerator
newCreateAccelerator :: Text -> Text -> CreateAccelerator
newCreateAccelerator Text
pName_ Text
pIdempotencyToken_ =
  CreateAccelerator'
    { $sel:enabled:CreateAccelerator' :: Maybe Bool
enabled = forall a. Maybe a
Prelude.Nothing,
      $sel:ipAddressType:CreateAccelerator' :: Maybe IpAddressType
ipAddressType = forall a. Maybe a
Prelude.Nothing,
      $sel:ipAddresses:CreateAccelerator' :: Maybe [Text]
ipAddresses = forall a. Maybe a
Prelude.Nothing,
      $sel:tags:CreateAccelerator' :: Maybe [Tag]
tags = forall a. Maybe a
Prelude.Nothing,
      $sel:name:CreateAccelerator' :: Text
name = Text
pName_,
      $sel:idempotencyToken:CreateAccelerator' :: Text
idempotencyToken = Text
pIdempotencyToken_
    }

-- | Indicates whether an accelerator is enabled. The value is true or false.
-- The default value is true.
--
-- If the value is set to true, an accelerator cannot be deleted. If set to
-- false, the accelerator can be deleted.
createAccelerator_enabled :: Lens.Lens' CreateAccelerator (Prelude.Maybe Prelude.Bool)
createAccelerator_enabled :: Lens' CreateAccelerator (Maybe Bool)
createAccelerator_enabled = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAccelerator' {Maybe Bool
enabled :: Maybe Bool
$sel:enabled:CreateAccelerator' :: CreateAccelerator -> Maybe Bool
enabled} -> Maybe Bool
enabled) (\s :: CreateAccelerator
s@CreateAccelerator' {} Maybe Bool
a -> CreateAccelerator
s {$sel:enabled:CreateAccelerator' :: Maybe Bool
enabled = Maybe Bool
a} :: CreateAccelerator)

-- | The IP address type that an accelerator supports. For a standard
-- accelerator, the value can be IPV4 or DUAL_STACK.
createAccelerator_ipAddressType :: Lens.Lens' CreateAccelerator (Prelude.Maybe IpAddressType)
createAccelerator_ipAddressType :: Lens' CreateAccelerator (Maybe IpAddressType)
createAccelerator_ipAddressType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAccelerator' {Maybe IpAddressType
ipAddressType :: Maybe IpAddressType
$sel:ipAddressType:CreateAccelerator' :: CreateAccelerator -> Maybe IpAddressType
ipAddressType} -> Maybe IpAddressType
ipAddressType) (\s :: CreateAccelerator
s@CreateAccelerator' {} Maybe IpAddressType
a -> CreateAccelerator
s {$sel:ipAddressType:CreateAccelerator' :: Maybe IpAddressType
ipAddressType = Maybe IpAddressType
a} :: CreateAccelerator)

-- | Optionally, if you\'ve added your own IP address pool to Global
-- Accelerator (BYOIP), you can choose an IPv4 address from your own pool
-- to use for the accelerator\'s static IPv4 address when you create an
-- accelerator.
--
-- After you bring an address range to Amazon Web Services, it appears in
-- your account as an address pool. When you create an accelerator, you can
-- assign one IPv4 address from your range to it. Global Accelerator
-- assigns you a second static IPv4 address from an Amazon IP address
-- range. If you bring two IPv4 address ranges to Amazon Web Services, you
-- can assign one IPv4 address from each range to your accelerator. This
-- restriction is because Global Accelerator assigns each address range to
-- a different network zone, for high availability.
--
-- You can specify one or two addresses, separated by a space. Do not
-- include the \/32 suffix.
--
-- Note that you can\'t update IP addresses for an existing accelerator. To
-- change them, you must create a new accelerator with the new addresses.
--
-- For more information, see
-- <https://docs.aws.amazon.com/global-accelerator/latest/dg/using-byoip.html Bring your own IP addresses (BYOIP)>
-- in the /Global Accelerator Developer Guide/.
createAccelerator_ipAddresses :: Lens.Lens' CreateAccelerator (Prelude.Maybe [Prelude.Text])
createAccelerator_ipAddresses :: Lens' CreateAccelerator (Maybe [Text])
createAccelerator_ipAddresses = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAccelerator' {Maybe [Text]
ipAddresses :: Maybe [Text]
$sel:ipAddresses:CreateAccelerator' :: CreateAccelerator -> Maybe [Text]
ipAddresses} -> Maybe [Text]
ipAddresses) (\s :: CreateAccelerator
s@CreateAccelerator' {} Maybe [Text]
a -> CreateAccelerator
s {$sel:ipAddresses:CreateAccelerator' :: Maybe [Text]
ipAddresses = Maybe [Text]
a} :: CreateAccelerator) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Create tags for an accelerator.
--
-- For more information, see
-- <https://docs.aws.amazon.com/global-accelerator/latest/dg/tagging-in-global-accelerator.html Tagging in Global Accelerator>
-- in the /Global Accelerator Developer Guide/.
createAccelerator_tags :: Lens.Lens' CreateAccelerator (Prelude.Maybe [Tag])
createAccelerator_tags :: Lens' CreateAccelerator (Maybe [Tag])
createAccelerator_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAccelerator' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateAccelerator' :: CreateAccelerator -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateAccelerator
s@CreateAccelerator' {} Maybe [Tag]
a -> CreateAccelerator
s {$sel:tags:CreateAccelerator' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateAccelerator) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name of the accelerator. The name can have a maximum of 64
-- characters, must contain only alphanumeric characters, periods (.), or
-- hyphens (-), and must not begin or end with a hyphen or period.
createAccelerator_name :: Lens.Lens' CreateAccelerator Prelude.Text
createAccelerator_name :: Lens' CreateAccelerator Text
createAccelerator_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAccelerator' {Text
name :: Text
$sel:name:CreateAccelerator' :: CreateAccelerator -> Text
name} -> Text
name) (\s :: CreateAccelerator
s@CreateAccelerator' {} Text
a -> CreateAccelerator
s {$sel:name:CreateAccelerator' :: Text
name = Text
a} :: CreateAccelerator)

-- | A unique, case-sensitive identifier that you provide to ensure the
-- idempotency—that is, the uniqueness—of an accelerator.
createAccelerator_idempotencyToken :: Lens.Lens' CreateAccelerator Prelude.Text
createAccelerator_idempotencyToken :: Lens' CreateAccelerator Text
createAccelerator_idempotencyToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAccelerator' {Text
idempotencyToken :: Text
$sel:idempotencyToken:CreateAccelerator' :: CreateAccelerator -> Text
idempotencyToken} -> Text
idempotencyToken) (\s :: CreateAccelerator
s@CreateAccelerator' {} Text
a -> CreateAccelerator
s {$sel:idempotencyToken:CreateAccelerator' :: Text
idempotencyToken = Text
a} :: CreateAccelerator)

instance Core.AWSRequest CreateAccelerator where
  type
    AWSResponse CreateAccelerator =
      CreateAcceleratorResponse
  request :: (Service -> Service)
-> CreateAccelerator -> Request CreateAccelerator
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateAccelerator
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateAccelerator)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Accelerator -> Int -> CreateAcceleratorResponse
CreateAcceleratorResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Accelerator")
            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 CreateAccelerator where
  hashWithSalt :: Int -> CreateAccelerator -> Int
hashWithSalt Int
_salt CreateAccelerator' {Maybe Bool
Maybe [Text]
Maybe [Tag]
Maybe IpAddressType
Text
idempotencyToken :: Text
name :: Text
tags :: Maybe [Tag]
ipAddresses :: Maybe [Text]
ipAddressType :: Maybe IpAddressType
enabled :: Maybe Bool
$sel:idempotencyToken:CreateAccelerator' :: CreateAccelerator -> Text
$sel:name:CreateAccelerator' :: CreateAccelerator -> Text
$sel:tags:CreateAccelerator' :: CreateAccelerator -> Maybe [Tag]
$sel:ipAddresses:CreateAccelerator' :: CreateAccelerator -> Maybe [Text]
$sel:ipAddressType:CreateAccelerator' :: CreateAccelerator -> Maybe IpAddressType
$sel:enabled:CreateAccelerator' :: CreateAccelerator -> Maybe Bool
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
enabled
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe IpAddressType
ipAddressType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
ipAddresses
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Tag]
tags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
idempotencyToken

instance Prelude.NFData CreateAccelerator where
  rnf :: CreateAccelerator -> ()
rnf CreateAccelerator' {Maybe Bool
Maybe [Text]
Maybe [Tag]
Maybe IpAddressType
Text
idempotencyToken :: Text
name :: Text
tags :: Maybe [Tag]
ipAddresses :: Maybe [Text]
ipAddressType :: Maybe IpAddressType
enabled :: Maybe Bool
$sel:idempotencyToken:CreateAccelerator' :: CreateAccelerator -> Text
$sel:name:CreateAccelerator' :: CreateAccelerator -> Text
$sel:tags:CreateAccelerator' :: CreateAccelerator -> Maybe [Tag]
$sel:ipAddresses:CreateAccelerator' :: CreateAccelerator -> Maybe [Text]
$sel:ipAddressType:CreateAccelerator' :: CreateAccelerator -> Maybe IpAddressType
$sel:enabled:CreateAccelerator' :: CreateAccelerator -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
enabled
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe IpAddressType
ipAddressType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
ipAddresses
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Tag]
tags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
idempotencyToken

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

instance Data.ToJSON CreateAccelerator where
  toJSON :: CreateAccelerator -> Value
toJSON CreateAccelerator' {Maybe Bool
Maybe [Text]
Maybe [Tag]
Maybe IpAddressType
Text
idempotencyToken :: Text
name :: Text
tags :: Maybe [Tag]
ipAddresses :: Maybe [Text]
ipAddressType :: Maybe IpAddressType
enabled :: Maybe Bool
$sel:idempotencyToken:CreateAccelerator' :: CreateAccelerator -> Text
$sel:name:CreateAccelerator' :: CreateAccelerator -> Text
$sel:tags:CreateAccelerator' :: CreateAccelerator -> Maybe [Tag]
$sel:ipAddresses:CreateAccelerator' :: CreateAccelerator -> Maybe [Text]
$sel:ipAddressType:CreateAccelerator' :: CreateAccelerator -> Maybe IpAddressType
$sel:enabled:CreateAccelerator' :: CreateAccelerator -> Maybe Bool
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"Enabled" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
enabled,
            (Key
"IpAddressType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe IpAddressType
ipAddressType,
            (Key
"IpAddresses" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
ipAddresses,
            (Key
"Tags" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
            forall a. a -> Maybe a
Prelude.Just (Key
"Name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"IdempotencyToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
idempotencyToken)
          ]
      )

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

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

-- | /See:/ 'newCreateAcceleratorResponse' smart constructor.
data CreateAcceleratorResponse = CreateAcceleratorResponse'
  { -- | The accelerator that is created by specifying a listener and the
    -- supported IP address types.
    CreateAcceleratorResponse -> Maybe Accelerator
accelerator :: Prelude.Maybe Accelerator,
    -- | The response's http status code.
    CreateAcceleratorResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateAcceleratorResponse -> CreateAcceleratorResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateAcceleratorResponse -> CreateAcceleratorResponse -> Bool
$c/= :: CreateAcceleratorResponse -> CreateAcceleratorResponse -> Bool
== :: CreateAcceleratorResponse -> CreateAcceleratorResponse -> Bool
$c== :: CreateAcceleratorResponse -> CreateAcceleratorResponse -> Bool
Prelude.Eq, ReadPrec [CreateAcceleratorResponse]
ReadPrec CreateAcceleratorResponse
Int -> ReadS CreateAcceleratorResponse
ReadS [CreateAcceleratorResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateAcceleratorResponse]
$creadListPrec :: ReadPrec [CreateAcceleratorResponse]
readPrec :: ReadPrec CreateAcceleratorResponse
$creadPrec :: ReadPrec CreateAcceleratorResponse
readList :: ReadS [CreateAcceleratorResponse]
$creadList :: ReadS [CreateAcceleratorResponse]
readsPrec :: Int -> ReadS CreateAcceleratorResponse
$creadsPrec :: Int -> ReadS CreateAcceleratorResponse
Prelude.Read, Int -> CreateAcceleratorResponse -> ShowS
[CreateAcceleratorResponse] -> ShowS
CreateAcceleratorResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateAcceleratorResponse] -> ShowS
$cshowList :: [CreateAcceleratorResponse] -> ShowS
show :: CreateAcceleratorResponse -> String
$cshow :: CreateAcceleratorResponse -> String
showsPrec :: Int -> CreateAcceleratorResponse -> ShowS
$cshowsPrec :: Int -> CreateAcceleratorResponse -> ShowS
Prelude.Show, forall x.
Rep CreateAcceleratorResponse x -> CreateAcceleratorResponse
forall x.
CreateAcceleratorResponse -> Rep CreateAcceleratorResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateAcceleratorResponse x -> CreateAcceleratorResponse
$cfrom :: forall x.
CreateAcceleratorResponse -> Rep CreateAcceleratorResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateAcceleratorResponse' 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:
--
-- 'accelerator', 'createAcceleratorResponse_accelerator' - The accelerator that is created by specifying a listener and the
-- supported IP address types.
--
-- 'httpStatus', 'createAcceleratorResponse_httpStatus' - The response's http status code.
newCreateAcceleratorResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateAcceleratorResponse
newCreateAcceleratorResponse :: Int -> CreateAcceleratorResponse
newCreateAcceleratorResponse Int
pHttpStatus_ =
  CreateAcceleratorResponse'
    { $sel:accelerator:CreateAcceleratorResponse' :: Maybe Accelerator
accelerator =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateAcceleratorResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The accelerator that is created by specifying a listener and the
-- supported IP address types.
createAcceleratorResponse_accelerator :: Lens.Lens' CreateAcceleratorResponse (Prelude.Maybe Accelerator)
createAcceleratorResponse_accelerator :: Lens' CreateAcceleratorResponse (Maybe Accelerator)
createAcceleratorResponse_accelerator = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAcceleratorResponse' {Maybe Accelerator
accelerator :: Maybe Accelerator
$sel:accelerator:CreateAcceleratorResponse' :: CreateAcceleratorResponse -> Maybe Accelerator
accelerator} -> Maybe Accelerator
accelerator) (\s :: CreateAcceleratorResponse
s@CreateAcceleratorResponse' {} Maybe Accelerator
a -> CreateAcceleratorResponse
s {$sel:accelerator:CreateAcceleratorResponse' :: Maybe Accelerator
accelerator = Maybe Accelerator
a} :: CreateAcceleratorResponse)

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

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