{-# 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.CreateCustomRoutingAccelerator
-- 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)
--
-- Create a custom routing accelerator. A custom routing accelerator
-- directs traffic to one of possibly thousands of Amazon EC2 instance
-- destinations running in a single or multiple virtual private clouds
-- (VPC) subnet endpoints.
--
-- Be aware that, by default, all destination EC2 instances in a VPC subnet
-- endpoint cannot receive traffic. To enable all destinations to receive
-- traffic, or to specify individual port mappings that can receive
-- traffic, see the
-- <https://docs.aws.amazon.com/global-accelerator/latest/api/API_AllowCustomRoutingTraffic.html AllowCustomRoutingTraffic>
-- operation.
--
-- Global Accelerator is a global service that supports endpoints in
-- multiple AWS Regions but you must specify the US West (Oregon) Region to
-- create or update accelerators.
module Amazonka.GlobalAccelerator.CreateCustomRoutingAccelerator
  ( -- * Creating a Request
    CreateCustomRoutingAccelerator (..),
    newCreateCustomRoutingAccelerator,

    -- * Request Lenses
    createCustomRoutingAccelerator_enabled,
    createCustomRoutingAccelerator_ipAddressType,
    createCustomRoutingAccelerator_tags,
    createCustomRoutingAccelerator_ipAddresses,
    createCustomRoutingAccelerator_name,
    createCustomRoutingAccelerator_idempotencyToken,

    -- * Destructuring the Response
    CreateCustomRoutingAcceleratorResponse (..),
    newCreateCustomRoutingAcceleratorResponse,

    -- * Response Lenses
    createCustomRoutingAcceleratorResponse_accelerator,
    createCustomRoutingAcceleratorResponse_httpStatus,
  )
where

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

-- | /See:/ 'newCreateCustomRoutingAccelerator' smart constructor.
data CreateCustomRoutingAccelerator = CreateCustomRoutingAccelerator'
  { -- | 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.
    CreateCustomRoutingAccelerator -> Maybe Bool
enabled :: Prelude.Maybe Prelude.Bool,
    -- | The value for the address type must be IPv4.
    CreateCustomRoutingAccelerator -> Maybe IpAddressType
ipAddressType :: Prelude.Maybe IpAddressType,
    -- | 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 AWS Global Accelerator>
    -- in the /AWS Global Accelerator Developer Guide/.
    CreateCustomRoutingAccelerator -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | Optionally, if you\'ve added your own IP address pool to Global
    -- Accelerator (BYOIP), you can choose IP addresses from your own pool to
    -- use for the accelerator\'s static IP addresses when you create an
    -- accelerator. You can specify one or two addresses, separated by a space.
    -- Do not include the \/32 suffix.
    --
    -- Only one IP address from each of your IP address ranges can be used for
    -- each accelerator. If you specify only one IP address from your IP
    -- address range, Global Accelerator assigns a second static IP address for
    -- the accelerator from the AWS IP address pool.
    --
    -- 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 /AWS Global Accelerator Developer Guide/.
    CreateCustomRoutingAccelerator -> Maybe [Text]
ipAddresses :: Prelude.Maybe [Prelude.Text],
    -- | The name of a custom routing accelerator. The name can have a maximum of
    -- 64 characters, must contain only alphanumeric characters or hyphens (-),
    -- and must not begin or end with a hyphen.
    CreateCustomRoutingAccelerator -> Text
name :: Prelude.Text,
    -- | A unique, case-sensitive identifier that you provide to ensure the
    -- idempotency—that is, the uniqueness—of the request.
    CreateCustomRoutingAccelerator -> Text
idempotencyToken :: Prelude.Text
  }
  deriving (CreateCustomRoutingAccelerator
-> CreateCustomRoutingAccelerator -> Bool
(CreateCustomRoutingAccelerator
 -> CreateCustomRoutingAccelerator -> Bool)
-> (CreateCustomRoutingAccelerator
    -> CreateCustomRoutingAccelerator -> Bool)
-> Eq CreateCustomRoutingAccelerator
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateCustomRoutingAccelerator
-> CreateCustomRoutingAccelerator -> Bool
$c/= :: CreateCustomRoutingAccelerator
-> CreateCustomRoutingAccelerator -> Bool
== :: CreateCustomRoutingAccelerator
-> CreateCustomRoutingAccelerator -> Bool
$c== :: CreateCustomRoutingAccelerator
-> CreateCustomRoutingAccelerator -> Bool
Prelude.Eq, ReadPrec [CreateCustomRoutingAccelerator]
ReadPrec CreateCustomRoutingAccelerator
Int -> ReadS CreateCustomRoutingAccelerator
ReadS [CreateCustomRoutingAccelerator]
(Int -> ReadS CreateCustomRoutingAccelerator)
-> ReadS [CreateCustomRoutingAccelerator]
-> ReadPrec CreateCustomRoutingAccelerator
-> ReadPrec [CreateCustomRoutingAccelerator]
-> Read CreateCustomRoutingAccelerator
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateCustomRoutingAccelerator]
$creadListPrec :: ReadPrec [CreateCustomRoutingAccelerator]
readPrec :: ReadPrec CreateCustomRoutingAccelerator
$creadPrec :: ReadPrec CreateCustomRoutingAccelerator
readList :: ReadS [CreateCustomRoutingAccelerator]
$creadList :: ReadS [CreateCustomRoutingAccelerator]
readsPrec :: Int -> ReadS CreateCustomRoutingAccelerator
$creadsPrec :: Int -> ReadS CreateCustomRoutingAccelerator
Prelude.Read, Int -> CreateCustomRoutingAccelerator -> ShowS
[CreateCustomRoutingAccelerator] -> ShowS
CreateCustomRoutingAccelerator -> String
(Int -> CreateCustomRoutingAccelerator -> ShowS)
-> (CreateCustomRoutingAccelerator -> String)
-> ([CreateCustomRoutingAccelerator] -> ShowS)
-> Show CreateCustomRoutingAccelerator
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateCustomRoutingAccelerator] -> ShowS
$cshowList :: [CreateCustomRoutingAccelerator] -> ShowS
show :: CreateCustomRoutingAccelerator -> String
$cshow :: CreateCustomRoutingAccelerator -> String
showsPrec :: Int -> CreateCustomRoutingAccelerator -> ShowS
$cshowsPrec :: Int -> CreateCustomRoutingAccelerator -> ShowS
Prelude.Show, (forall x.
 CreateCustomRoutingAccelerator
 -> Rep CreateCustomRoutingAccelerator x)
-> (forall x.
    Rep CreateCustomRoutingAccelerator x
    -> CreateCustomRoutingAccelerator)
-> Generic CreateCustomRoutingAccelerator
forall x.
Rep CreateCustomRoutingAccelerator x
-> CreateCustomRoutingAccelerator
forall x.
CreateCustomRoutingAccelerator
-> Rep CreateCustomRoutingAccelerator x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateCustomRoutingAccelerator x
-> CreateCustomRoutingAccelerator
$cfrom :: forall x.
CreateCustomRoutingAccelerator
-> Rep CreateCustomRoutingAccelerator x
Prelude.Generic)

-- |
-- Create a value of 'CreateCustomRoutingAccelerator' 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', 'createCustomRoutingAccelerator_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', 'createCustomRoutingAccelerator_ipAddressType' - The value for the address type must be IPv4.
--
-- 'tags', 'createCustomRoutingAccelerator_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 AWS Global Accelerator>
-- in the /AWS Global Accelerator Developer Guide/.
--
-- 'ipAddresses', 'createCustomRoutingAccelerator_ipAddresses' - Optionally, if you\'ve added your own IP address pool to Global
-- Accelerator (BYOIP), you can choose IP addresses from your own pool to
-- use for the accelerator\'s static IP addresses when you create an
-- accelerator. You can specify one or two addresses, separated by a space.
-- Do not include the \/32 suffix.
--
-- Only one IP address from each of your IP address ranges can be used for
-- each accelerator. If you specify only one IP address from your IP
-- address range, Global Accelerator assigns a second static IP address for
-- the accelerator from the AWS IP address pool.
--
-- 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 /AWS Global Accelerator Developer Guide/.
--
-- 'name', 'createCustomRoutingAccelerator_name' - The name of a custom routing accelerator. The name can have a maximum of
-- 64 characters, must contain only alphanumeric characters or hyphens (-),
-- and must not begin or end with a hyphen.
--
-- 'idempotencyToken', 'createCustomRoutingAccelerator_idempotencyToken' - A unique, case-sensitive identifier that you provide to ensure the
-- idempotency—that is, the uniqueness—of the request.
newCreateCustomRoutingAccelerator ::
  -- | 'name'
  Prelude.Text ->
  -- | 'idempotencyToken'
  Prelude.Text ->
  CreateCustomRoutingAccelerator
newCreateCustomRoutingAccelerator :: Text -> Text -> CreateCustomRoutingAccelerator
newCreateCustomRoutingAccelerator
  Text
pName_
  Text
pIdempotencyToken_ =
    CreateCustomRoutingAccelerator' :: Maybe Bool
-> Maybe IpAddressType
-> Maybe [Tag]
-> Maybe [Text]
-> Text
-> Text
-> CreateCustomRoutingAccelerator
CreateCustomRoutingAccelerator'
      { $sel:enabled:CreateCustomRoutingAccelerator' :: Maybe Bool
enabled =
          Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:ipAddressType:CreateCustomRoutingAccelerator' :: Maybe IpAddressType
ipAddressType = Maybe IpAddressType
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateCustomRoutingAccelerator' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
        $sel:ipAddresses:CreateCustomRoutingAccelerator' :: Maybe [Text]
ipAddresses = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
        $sel:name:CreateCustomRoutingAccelerator' :: Text
name = Text
pName_,
        $sel:idempotencyToken:CreateCustomRoutingAccelerator' :: 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.
createCustomRoutingAccelerator_enabled :: Lens.Lens' CreateCustomRoutingAccelerator (Prelude.Maybe Prelude.Bool)
createCustomRoutingAccelerator_enabled :: (Maybe Bool -> f (Maybe Bool))
-> CreateCustomRoutingAccelerator
-> f CreateCustomRoutingAccelerator
createCustomRoutingAccelerator_enabled = (CreateCustomRoutingAccelerator -> Maybe Bool)
-> (CreateCustomRoutingAccelerator
    -> Maybe Bool -> CreateCustomRoutingAccelerator)
-> Lens
     CreateCustomRoutingAccelerator
     CreateCustomRoutingAccelerator
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCustomRoutingAccelerator' {Maybe Bool
enabled :: Maybe Bool
$sel:enabled:CreateCustomRoutingAccelerator' :: CreateCustomRoutingAccelerator -> Maybe Bool
enabled} -> Maybe Bool
enabled) (\s :: CreateCustomRoutingAccelerator
s@CreateCustomRoutingAccelerator' {} Maybe Bool
a -> CreateCustomRoutingAccelerator
s {$sel:enabled:CreateCustomRoutingAccelerator' :: Maybe Bool
enabled = Maybe Bool
a} :: CreateCustomRoutingAccelerator)

-- | The value for the address type must be IPv4.
createCustomRoutingAccelerator_ipAddressType :: Lens.Lens' CreateCustomRoutingAccelerator (Prelude.Maybe IpAddressType)
createCustomRoutingAccelerator_ipAddressType :: (Maybe IpAddressType -> f (Maybe IpAddressType))
-> CreateCustomRoutingAccelerator
-> f CreateCustomRoutingAccelerator
createCustomRoutingAccelerator_ipAddressType = (CreateCustomRoutingAccelerator -> Maybe IpAddressType)
-> (CreateCustomRoutingAccelerator
    -> Maybe IpAddressType -> CreateCustomRoutingAccelerator)
-> Lens
     CreateCustomRoutingAccelerator
     CreateCustomRoutingAccelerator
     (Maybe IpAddressType)
     (Maybe IpAddressType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCustomRoutingAccelerator' {Maybe IpAddressType
ipAddressType :: Maybe IpAddressType
$sel:ipAddressType:CreateCustomRoutingAccelerator' :: CreateCustomRoutingAccelerator -> Maybe IpAddressType
ipAddressType} -> Maybe IpAddressType
ipAddressType) (\s :: CreateCustomRoutingAccelerator
s@CreateCustomRoutingAccelerator' {} Maybe IpAddressType
a -> CreateCustomRoutingAccelerator
s {$sel:ipAddressType:CreateCustomRoutingAccelerator' :: Maybe IpAddressType
ipAddressType = Maybe IpAddressType
a} :: CreateCustomRoutingAccelerator)

-- | 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 AWS Global Accelerator>
-- in the /AWS Global Accelerator Developer Guide/.
createCustomRoutingAccelerator_tags :: Lens.Lens' CreateCustomRoutingAccelerator (Prelude.Maybe [Tag])
createCustomRoutingAccelerator_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateCustomRoutingAccelerator
-> f CreateCustomRoutingAccelerator
createCustomRoutingAccelerator_tags = (CreateCustomRoutingAccelerator -> Maybe [Tag])
-> (CreateCustomRoutingAccelerator
    -> Maybe [Tag] -> CreateCustomRoutingAccelerator)
-> Lens
     CreateCustomRoutingAccelerator
     CreateCustomRoutingAccelerator
     (Maybe [Tag])
     (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCustomRoutingAccelerator' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateCustomRoutingAccelerator' :: CreateCustomRoutingAccelerator -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateCustomRoutingAccelerator
s@CreateCustomRoutingAccelerator' {} Maybe [Tag]
a -> CreateCustomRoutingAccelerator
s {$sel:tags:CreateCustomRoutingAccelerator' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateCustomRoutingAccelerator) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> CreateCustomRoutingAccelerator
 -> f CreateCustomRoutingAccelerator)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateCustomRoutingAccelerator
-> f CreateCustomRoutingAccelerator
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
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 AnIso [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Optionally, if you\'ve added your own IP address pool to Global
-- Accelerator (BYOIP), you can choose IP addresses from your own pool to
-- use for the accelerator\'s static IP addresses when you create an
-- accelerator. You can specify one or two addresses, separated by a space.
-- Do not include the \/32 suffix.
--
-- Only one IP address from each of your IP address ranges can be used for
-- each accelerator. If you specify only one IP address from your IP
-- address range, Global Accelerator assigns a second static IP address for
-- the accelerator from the AWS IP address pool.
--
-- 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 /AWS Global Accelerator Developer Guide/.
createCustomRoutingAccelerator_ipAddresses :: Lens.Lens' CreateCustomRoutingAccelerator (Prelude.Maybe [Prelude.Text])
createCustomRoutingAccelerator_ipAddresses :: (Maybe [Text] -> f (Maybe [Text]))
-> CreateCustomRoutingAccelerator
-> f CreateCustomRoutingAccelerator
createCustomRoutingAccelerator_ipAddresses = (CreateCustomRoutingAccelerator -> Maybe [Text])
-> (CreateCustomRoutingAccelerator
    -> Maybe [Text] -> CreateCustomRoutingAccelerator)
-> Lens
     CreateCustomRoutingAccelerator
     CreateCustomRoutingAccelerator
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCustomRoutingAccelerator' {Maybe [Text]
ipAddresses :: Maybe [Text]
$sel:ipAddresses:CreateCustomRoutingAccelerator' :: CreateCustomRoutingAccelerator -> Maybe [Text]
ipAddresses} -> Maybe [Text]
ipAddresses) (\s :: CreateCustomRoutingAccelerator
s@CreateCustomRoutingAccelerator' {} Maybe [Text]
a -> CreateCustomRoutingAccelerator
s {$sel:ipAddresses:CreateCustomRoutingAccelerator' :: Maybe [Text]
ipAddresses = Maybe [Text]
a} :: CreateCustomRoutingAccelerator) ((Maybe [Text] -> f (Maybe [Text]))
 -> CreateCustomRoutingAccelerator
 -> f CreateCustomRoutingAccelerator)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> CreateCustomRoutingAccelerator
-> f CreateCustomRoutingAccelerator
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

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

instance
  Core.AWSRequest
    CreateCustomRoutingAccelerator
  where
  type
    AWSResponse CreateCustomRoutingAccelerator =
      CreateCustomRoutingAcceleratorResponse
  request :: CreateCustomRoutingAccelerator
-> Request CreateCustomRoutingAccelerator
request = Service
-> CreateCustomRoutingAccelerator
-> Request CreateCustomRoutingAccelerator
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateCustomRoutingAccelerator
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse CreateCustomRoutingAccelerator)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateCustomRoutingAccelerator))
-> Logger
-> Service
-> Proxy CreateCustomRoutingAccelerator
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse CreateCustomRoutingAccelerator)))
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 CustomRoutingAccelerator
-> Int -> CreateCustomRoutingAcceleratorResponse
CreateCustomRoutingAcceleratorResponse'
            (Maybe CustomRoutingAccelerator
 -> Int -> CreateCustomRoutingAcceleratorResponse)
-> Either String (Maybe CustomRoutingAccelerator)
-> Either String (Int -> CreateCustomRoutingAcceleratorResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe CustomRoutingAccelerator)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Accelerator")
            Either String (Int -> CreateCustomRoutingAcceleratorResponse)
-> Either String Int
-> Either String CreateCustomRoutingAcceleratorResponse
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
    CreateCustomRoutingAccelerator

instance
  Prelude.NFData
    CreateCustomRoutingAccelerator

instance
  Core.ToHeaders
    CreateCustomRoutingAccelerator
  where
  toHeaders :: CreateCustomRoutingAccelerator -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> CreateCustomRoutingAccelerator -> 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
"GlobalAccelerator_V20180706.CreateCustomRoutingAccelerator" ::
                          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 CreateCustomRoutingAccelerator where
  toJSON :: CreateCustomRoutingAccelerator -> Value
toJSON CreateCustomRoutingAccelerator' {Maybe Bool
Maybe [Text]
Maybe [Tag]
Maybe IpAddressType
Text
idempotencyToken :: Text
name :: Text
ipAddresses :: Maybe [Text]
tags :: Maybe [Tag]
ipAddressType :: Maybe IpAddressType
enabled :: Maybe Bool
$sel:idempotencyToken:CreateCustomRoutingAccelerator' :: CreateCustomRoutingAccelerator -> Text
$sel:name:CreateCustomRoutingAccelerator' :: CreateCustomRoutingAccelerator -> Text
$sel:ipAddresses:CreateCustomRoutingAccelerator' :: CreateCustomRoutingAccelerator -> Maybe [Text]
$sel:tags:CreateCustomRoutingAccelerator' :: CreateCustomRoutingAccelerator -> Maybe [Tag]
$sel:ipAddressType:CreateCustomRoutingAccelerator' :: CreateCustomRoutingAccelerator -> Maybe IpAddressType
$sel:enabled:CreateCustomRoutingAccelerator' :: CreateCustomRoutingAccelerator -> Maybe Bool
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Enabled" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
enabled,
            (Text
"IpAddressType" Text -> IpAddressType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (IpAddressType -> Pair) -> Maybe IpAddressType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe IpAddressType
ipAddressType,
            (Text
"Tags" Text -> [Tag] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Tag] -> Pair) -> Maybe [Tag] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
            (Text
"IpAddresses" 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]
ipAddresses,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"IdempotencyToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
idempotencyToken)
          ]
      )

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

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

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

-- |
-- Create a value of 'CreateCustomRoutingAcceleratorResponse' 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', 'createCustomRoutingAcceleratorResponse_accelerator' - The accelerator that is created.
--
-- 'httpStatus', 'createCustomRoutingAcceleratorResponse_httpStatus' - The response's http status code.
newCreateCustomRoutingAcceleratorResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateCustomRoutingAcceleratorResponse
newCreateCustomRoutingAcceleratorResponse :: Int -> CreateCustomRoutingAcceleratorResponse
newCreateCustomRoutingAcceleratorResponse
  Int
pHttpStatus_ =
    CreateCustomRoutingAcceleratorResponse' :: Maybe CustomRoutingAccelerator
-> Int -> CreateCustomRoutingAcceleratorResponse
CreateCustomRoutingAcceleratorResponse'
      { $sel:accelerator:CreateCustomRoutingAcceleratorResponse' :: Maybe CustomRoutingAccelerator
accelerator =
          Maybe CustomRoutingAccelerator
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:CreateCustomRoutingAcceleratorResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | The accelerator that is created.
createCustomRoutingAcceleratorResponse_accelerator :: Lens.Lens' CreateCustomRoutingAcceleratorResponse (Prelude.Maybe CustomRoutingAccelerator)
createCustomRoutingAcceleratorResponse_accelerator :: (Maybe CustomRoutingAccelerator
 -> f (Maybe CustomRoutingAccelerator))
-> CreateCustomRoutingAcceleratorResponse
-> f CreateCustomRoutingAcceleratorResponse
createCustomRoutingAcceleratorResponse_accelerator = (CreateCustomRoutingAcceleratorResponse
 -> Maybe CustomRoutingAccelerator)
-> (CreateCustomRoutingAcceleratorResponse
    -> Maybe CustomRoutingAccelerator
    -> CreateCustomRoutingAcceleratorResponse)
-> Lens
     CreateCustomRoutingAcceleratorResponse
     CreateCustomRoutingAcceleratorResponse
     (Maybe CustomRoutingAccelerator)
     (Maybe CustomRoutingAccelerator)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCustomRoutingAcceleratorResponse' {Maybe CustomRoutingAccelerator
accelerator :: Maybe CustomRoutingAccelerator
$sel:accelerator:CreateCustomRoutingAcceleratorResponse' :: CreateCustomRoutingAcceleratorResponse
-> Maybe CustomRoutingAccelerator
accelerator} -> Maybe CustomRoutingAccelerator
accelerator) (\s :: CreateCustomRoutingAcceleratorResponse
s@CreateCustomRoutingAcceleratorResponse' {} Maybe CustomRoutingAccelerator
a -> CreateCustomRoutingAcceleratorResponse
s {$sel:accelerator:CreateCustomRoutingAcceleratorResponse' :: Maybe CustomRoutingAccelerator
accelerator = Maybe CustomRoutingAccelerator
a} :: CreateCustomRoutingAcceleratorResponse)

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

instance
  Prelude.NFData
    CreateCustomRoutingAcceleratorResponse