{-# 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.NetworkManager.CreateDevice
-- 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)
--
-- Creates a new device in a global network. If you specify both a site ID
-- and a location, the location of the site is used for visualization in
-- the Network Manager console.
module Amazonka.NetworkManager.CreateDevice
  ( -- * Creating a Request
    CreateDevice (..),
    newCreateDevice,

    -- * Request Lenses
    createDevice_vendor,
    createDevice_location,
    createDevice_aWSLocation,
    createDevice_model,
    createDevice_type,
    createDevice_serialNumber,
    createDevice_siteId,
    createDevice_description,
    createDevice_tags,
    createDevice_globalNetworkId,

    -- * Destructuring the Response
    CreateDeviceResponse (..),
    newCreateDeviceResponse,

    -- * Response Lenses
    createDeviceResponse_device,
    createDeviceResponse_httpStatus,
  )
where

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

-- | /See:/ 'newCreateDevice' smart constructor.
data CreateDevice = CreateDevice'
  { -- | The vendor of the device.
    --
    -- Length Constraints: Maximum length of 128 characters.
    CreateDevice -> Maybe Text
vendor :: Prelude.Maybe Prelude.Text,
    -- | The location of the device.
    CreateDevice -> Maybe (Sensitive Location)
location :: Prelude.Maybe (Core.Sensitive Location),
    -- | The AWS location of the device.
    CreateDevice -> Maybe AWSLocation
aWSLocation :: Prelude.Maybe AWSLocation,
    -- | The model of the device.
    --
    -- Length Constraints: Maximum length of 128 characters.
    CreateDevice -> Maybe Text
model :: Prelude.Maybe Prelude.Text,
    -- | The type of the device.
    CreateDevice -> Maybe Text
type' :: Prelude.Maybe Prelude.Text,
    -- | The serial number of the device.
    --
    -- Length Constraints: Maximum length of 128 characters.
    CreateDevice -> Maybe Text
serialNumber :: Prelude.Maybe Prelude.Text,
    -- | The ID of the site.
    CreateDevice -> Maybe Text
siteId :: Prelude.Maybe Prelude.Text,
    -- | A description of the device.
    --
    -- Length Constraints: Maximum length of 256 characters.
    CreateDevice -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The tags to apply to the resource during creation.
    CreateDevice -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | The ID of the global network.
    CreateDevice -> Text
globalNetworkId :: Prelude.Text
  }
  deriving (CreateDevice -> CreateDevice -> Bool
(CreateDevice -> CreateDevice -> Bool)
-> (CreateDevice -> CreateDevice -> Bool) -> Eq CreateDevice
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDevice -> CreateDevice -> Bool
$c/= :: CreateDevice -> CreateDevice -> Bool
== :: CreateDevice -> CreateDevice -> Bool
$c== :: CreateDevice -> CreateDevice -> Bool
Prelude.Eq, Int -> CreateDevice -> ShowS
[CreateDevice] -> ShowS
CreateDevice -> String
(Int -> CreateDevice -> ShowS)
-> (CreateDevice -> String)
-> ([CreateDevice] -> ShowS)
-> Show CreateDevice
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDevice] -> ShowS
$cshowList :: [CreateDevice] -> ShowS
show :: CreateDevice -> String
$cshow :: CreateDevice -> String
showsPrec :: Int -> CreateDevice -> ShowS
$cshowsPrec :: Int -> CreateDevice -> ShowS
Prelude.Show, (forall x. CreateDevice -> Rep CreateDevice x)
-> (forall x. Rep CreateDevice x -> CreateDevice)
-> Generic CreateDevice
forall x. Rep CreateDevice x -> CreateDevice
forall x. CreateDevice -> Rep CreateDevice x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateDevice x -> CreateDevice
$cfrom :: forall x. CreateDevice -> Rep CreateDevice x
Prelude.Generic)

-- |
-- Create a value of 'CreateDevice' 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:
--
-- 'vendor', 'createDevice_vendor' - The vendor of the device.
--
-- Length Constraints: Maximum length of 128 characters.
--
-- 'location', 'createDevice_location' - The location of the device.
--
-- 'aWSLocation', 'createDevice_aWSLocation' - The AWS location of the device.
--
-- 'model', 'createDevice_model' - The model of the device.
--
-- Length Constraints: Maximum length of 128 characters.
--
-- 'type'', 'createDevice_type' - The type of the device.
--
-- 'serialNumber', 'createDevice_serialNumber' - The serial number of the device.
--
-- Length Constraints: Maximum length of 128 characters.
--
-- 'siteId', 'createDevice_siteId' - The ID of the site.
--
-- 'description', 'createDevice_description' - A description of the device.
--
-- Length Constraints: Maximum length of 256 characters.
--
-- 'tags', 'createDevice_tags' - The tags to apply to the resource during creation.
--
-- 'globalNetworkId', 'createDevice_globalNetworkId' - The ID of the global network.
newCreateDevice ::
  -- | 'globalNetworkId'
  Prelude.Text ->
  CreateDevice
newCreateDevice :: Text -> CreateDevice
newCreateDevice Text
pGlobalNetworkId_ =
  CreateDevice' :: Maybe Text
-> Maybe (Sensitive Location)
-> Maybe AWSLocation
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [Tag]
-> Text
-> CreateDevice
CreateDevice'
    { $sel:vendor:CreateDevice' :: Maybe Text
vendor = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:location:CreateDevice' :: Maybe (Sensitive Location)
location = Maybe (Sensitive Location)
forall a. Maybe a
Prelude.Nothing,
      $sel:aWSLocation:CreateDevice' :: Maybe AWSLocation
aWSLocation = Maybe AWSLocation
forall a. Maybe a
Prelude.Nothing,
      $sel:model:CreateDevice' :: Maybe Text
model = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:type':CreateDevice' :: Maybe Text
type' = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:serialNumber:CreateDevice' :: Maybe Text
serialNumber = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:siteId:CreateDevice' :: Maybe Text
siteId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:CreateDevice' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:CreateDevice' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
      $sel:globalNetworkId:CreateDevice' :: Text
globalNetworkId = Text
pGlobalNetworkId_
    }

-- | The vendor of the device.
--
-- Length Constraints: Maximum length of 128 characters.
createDevice_vendor :: Lens.Lens' CreateDevice (Prelude.Maybe Prelude.Text)
createDevice_vendor :: (Maybe Text -> f (Maybe Text)) -> CreateDevice -> f CreateDevice
createDevice_vendor = (CreateDevice -> Maybe Text)
-> (CreateDevice -> Maybe Text -> CreateDevice)
-> Lens CreateDevice CreateDevice (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDevice' {Maybe Text
vendor :: Maybe Text
$sel:vendor:CreateDevice' :: CreateDevice -> Maybe Text
vendor} -> Maybe Text
vendor) (\s :: CreateDevice
s@CreateDevice' {} Maybe Text
a -> CreateDevice
s {$sel:vendor:CreateDevice' :: Maybe Text
vendor = Maybe Text
a} :: CreateDevice)

-- | The location of the device.
createDevice_location :: Lens.Lens' CreateDevice (Prelude.Maybe Location)
createDevice_location :: (Maybe Location -> f (Maybe Location))
-> CreateDevice -> f CreateDevice
createDevice_location = (CreateDevice -> Maybe (Sensitive Location))
-> (CreateDevice -> Maybe (Sensitive Location) -> CreateDevice)
-> Lens
     CreateDevice
     CreateDevice
     (Maybe (Sensitive Location))
     (Maybe (Sensitive Location))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDevice' {Maybe (Sensitive Location)
location :: Maybe (Sensitive Location)
$sel:location:CreateDevice' :: CreateDevice -> Maybe (Sensitive Location)
location} -> Maybe (Sensitive Location)
location) (\s :: CreateDevice
s@CreateDevice' {} Maybe (Sensitive Location)
a -> CreateDevice
s {$sel:location:CreateDevice' :: Maybe (Sensitive Location)
location = Maybe (Sensitive Location)
a} :: CreateDevice) ((Maybe (Sensitive Location) -> f (Maybe (Sensitive Location)))
 -> CreateDevice -> f CreateDevice)
-> ((Maybe Location -> f (Maybe Location))
    -> Maybe (Sensitive Location) -> f (Maybe (Sensitive Location)))
-> (Maybe Location -> f (Maybe Location))
-> CreateDevice
-> f CreateDevice
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Location) (Sensitive Location) Location Location
-> Iso
     (Maybe (Sensitive Location))
     (Maybe (Sensitive Location))
     (Maybe Location)
     (Maybe Location)
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 (Sensitive Location) (Sensitive Location) Location Location
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | The AWS location of the device.
createDevice_aWSLocation :: Lens.Lens' CreateDevice (Prelude.Maybe AWSLocation)
createDevice_aWSLocation :: (Maybe AWSLocation -> f (Maybe AWSLocation))
-> CreateDevice -> f CreateDevice
createDevice_aWSLocation = (CreateDevice -> Maybe AWSLocation)
-> (CreateDevice -> Maybe AWSLocation -> CreateDevice)
-> Lens
     CreateDevice CreateDevice (Maybe AWSLocation) (Maybe AWSLocation)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDevice' {Maybe AWSLocation
aWSLocation :: Maybe AWSLocation
$sel:aWSLocation:CreateDevice' :: CreateDevice -> Maybe AWSLocation
aWSLocation} -> Maybe AWSLocation
aWSLocation) (\s :: CreateDevice
s@CreateDevice' {} Maybe AWSLocation
a -> CreateDevice
s {$sel:aWSLocation:CreateDevice' :: Maybe AWSLocation
aWSLocation = Maybe AWSLocation
a} :: CreateDevice)

-- | The model of the device.
--
-- Length Constraints: Maximum length of 128 characters.
createDevice_model :: Lens.Lens' CreateDevice (Prelude.Maybe Prelude.Text)
createDevice_model :: (Maybe Text -> f (Maybe Text)) -> CreateDevice -> f CreateDevice
createDevice_model = (CreateDevice -> Maybe Text)
-> (CreateDevice -> Maybe Text -> CreateDevice)
-> Lens CreateDevice CreateDevice (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDevice' {Maybe Text
model :: Maybe Text
$sel:model:CreateDevice' :: CreateDevice -> Maybe Text
model} -> Maybe Text
model) (\s :: CreateDevice
s@CreateDevice' {} Maybe Text
a -> CreateDevice
s {$sel:model:CreateDevice' :: Maybe Text
model = Maybe Text
a} :: CreateDevice)

-- | The type of the device.
createDevice_type :: Lens.Lens' CreateDevice (Prelude.Maybe Prelude.Text)
createDevice_type :: (Maybe Text -> f (Maybe Text)) -> CreateDevice -> f CreateDevice
createDevice_type = (CreateDevice -> Maybe Text)
-> (CreateDevice -> Maybe Text -> CreateDevice)
-> Lens CreateDevice CreateDevice (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDevice' {Maybe Text
type' :: Maybe Text
$sel:type':CreateDevice' :: CreateDevice -> Maybe Text
type'} -> Maybe Text
type') (\s :: CreateDevice
s@CreateDevice' {} Maybe Text
a -> CreateDevice
s {$sel:type':CreateDevice' :: Maybe Text
type' = Maybe Text
a} :: CreateDevice)

-- | The serial number of the device.
--
-- Length Constraints: Maximum length of 128 characters.
createDevice_serialNumber :: Lens.Lens' CreateDevice (Prelude.Maybe Prelude.Text)
createDevice_serialNumber :: (Maybe Text -> f (Maybe Text)) -> CreateDevice -> f CreateDevice
createDevice_serialNumber = (CreateDevice -> Maybe Text)
-> (CreateDevice -> Maybe Text -> CreateDevice)
-> Lens CreateDevice CreateDevice (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDevice' {Maybe Text
serialNumber :: Maybe Text
$sel:serialNumber:CreateDevice' :: CreateDevice -> Maybe Text
serialNumber} -> Maybe Text
serialNumber) (\s :: CreateDevice
s@CreateDevice' {} Maybe Text
a -> CreateDevice
s {$sel:serialNumber:CreateDevice' :: Maybe Text
serialNumber = Maybe Text
a} :: CreateDevice)

-- | The ID of the site.
createDevice_siteId :: Lens.Lens' CreateDevice (Prelude.Maybe Prelude.Text)
createDevice_siteId :: (Maybe Text -> f (Maybe Text)) -> CreateDevice -> f CreateDevice
createDevice_siteId = (CreateDevice -> Maybe Text)
-> (CreateDevice -> Maybe Text -> CreateDevice)
-> Lens CreateDevice CreateDevice (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDevice' {Maybe Text
siteId :: Maybe Text
$sel:siteId:CreateDevice' :: CreateDevice -> Maybe Text
siteId} -> Maybe Text
siteId) (\s :: CreateDevice
s@CreateDevice' {} Maybe Text
a -> CreateDevice
s {$sel:siteId:CreateDevice' :: Maybe Text
siteId = Maybe Text
a} :: CreateDevice)

-- | A description of the device.
--
-- Length Constraints: Maximum length of 256 characters.
createDevice_description :: Lens.Lens' CreateDevice (Prelude.Maybe Prelude.Text)
createDevice_description :: (Maybe Text -> f (Maybe Text)) -> CreateDevice -> f CreateDevice
createDevice_description = (CreateDevice -> Maybe Text)
-> (CreateDevice -> Maybe Text -> CreateDevice)
-> Lens CreateDevice CreateDevice (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDevice' {Maybe Text
description :: Maybe Text
$sel:description:CreateDevice' :: CreateDevice -> Maybe Text
description} -> Maybe Text
description) (\s :: CreateDevice
s@CreateDevice' {} Maybe Text
a -> CreateDevice
s {$sel:description:CreateDevice' :: Maybe Text
description = Maybe Text
a} :: CreateDevice)

-- | The tags to apply to the resource during creation.
createDevice_tags :: Lens.Lens' CreateDevice (Prelude.Maybe [Tag])
createDevice_tags :: (Maybe [Tag] -> f (Maybe [Tag])) -> CreateDevice -> f CreateDevice
createDevice_tags = (CreateDevice -> Maybe [Tag])
-> (CreateDevice -> Maybe [Tag] -> CreateDevice)
-> Lens CreateDevice CreateDevice (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDevice' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateDevice' :: CreateDevice -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateDevice
s@CreateDevice' {} Maybe [Tag]
a -> CreateDevice
s {$sel:tags:CreateDevice' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateDevice) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> CreateDevice -> f CreateDevice)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateDevice
-> f CreateDevice
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

-- | The ID of the global network.
createDevice_globalNetworkId :: Lens.Lens' CreateDevice Prelude.Text
createDevice_globalNetworkId :: (Text -> f Text) -> CreateDevice -> f CreateDevice
createDevice_globalNetworkId = (CreateDevice -> Text)
-> (CreateDevice -> Text -> CreateDevice)
-> Lens CreateDevice CreateDevice Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDevice' {Text
globalNetworkId :: Text
$sel:globalNetworkId:CreateDevice' :: CreateDevice -> Text
globalNetworkId} -> Text
globalNetworkId) (\s :: CreateDevice
s@CreateDevice' {} Text
a -> CreateDevice
s {$sel:globalNetworkId:CreateDevice' :: Text
globalNetworkId = Text
a} :: CreateDevice)

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

instance Prelude.NFData CreateDevice

instance Core.ToHeaders CreateDevice where
  toHeaders :: CreateDevice -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateDevice -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ 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 CreateDevice where
  toJSON :: CreateDevice -> Value
toJSON CreateDevice' {Maybe [Tag]
Maybe Text
Maybe (Sensitive Location)
Maybe AWSLocation
Text
globalNetworkId :: Text
tags :: Maybe [Tag]
description :: Maybe Text
siteId :: Maybe Text
serialNumber :: Maybe Text
type' :: Maybe Text
model :: Maybe Text
aWSLocation :: Maybe AWSLocation
location :: Maybe (Sensitive Location)
vendor :: Maybe Text
$sel:globalNetworkId:CreateDevice' :: CreateDevice -> Text
$sel:tags:CreateDevice' :: CreateDevice -> Maybe [Tag]
$sel:description:CreateDevice' :: CreateDevice -> Maybe Text
$sel:siteId:CreateDevice' :: CreateDevice -> Maybe Text
$sel:serialNumber:CreateDevice' :: CreateDevice -> Maybe Text
$sel:type':CreateDevice' :: CreateDevice -> Maybe Text
$sel:model:CreateDevice' :: CreateDevice -> Maybe Text
$sel:aWSLocation:CreateDevice' :: CreateDevice -> Maybe AWSLocation
$sel:location:CreateDevice' :: CreateDevice -> Maybe (Sensitive Location)
$sel:vendor:CreateDevice' :: CreateDevice -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Vendor" 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
vendor,
            (Text
"Location" Text -> Sensitive Location -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Sensitive Location -> Pair)
-> Maybe (Sensitive Location) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive Location)
location,
            (Text
"AWSLocation" Text -> AWSLocation -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (AWSLocation -> Pair) -> Maybe AWSLocation -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AWSLocation
aWSLocation,
            (Text
"Model" 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
model,
            (Text
"Type" 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
type',
            (Text
"SerialNumber" 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
serialNumber,
            (Text
"SiteId" 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
siteId,
            (Text
"Description" 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
description,
            (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
          ]
      )

instance Core.ToPath CreateDevice where
  toPath :: CreateDevice -> ByteString
toPath CreateDevice' {Maybe [Tag]
Maybe Text
Maybe (Sensitive Location)
Maybe AWSLocation
Text
globalNetworkId :: Text
tags :: Maybe [Tag]
description :: Maybe Text
siteId :: Maybe Text
serialNumber :: Maybe Text
type' :: Maybe Text
model :: Maybe Text
aWSLocation :: Maybe AWSLocation
location :: Maybe (Sensitive Location)
vendor :: Maybe Text
$sel:globalNetworkId:CreateDevice' :: CreateDevice -> Text
$sel:tags:CreateDevice' :: CreateDevice -> Maybe [Tag]
$sel:description:CreateDevice' :: CreateDevice -> Maybe Text
$sel:siteId:CreateDevice' :: CreateDevice -> Maybe Text
$sel:serialNumber:CreateDevice' :: CreateDevice -> Maybe Text
$sel:type':CreateDevice' :: CreateDevice -> Maybe Text
$sel:model:CreateDevice' :: CreateDevice -> Maybe Text
$sel:aWSLocation:CreateDevice' :: CreateDevice -> Maybe AWSLocation
$sel:location:CreateDevice' :: CreateDevice -> Maybe (Sensitive Location)
$sel:vendor:CreateDevice' :: CreateDevice -> Maybe Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/global-networks/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
globalNetworkId,
        ByteString
"/devices"
      ]

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

-- | /See:/ 'newCreateDeviceResponse' smart constructor.
data CreateDeviceResponse = CreateDeviceResponse'
  { -- | Information about the device.
    CreateDeviceResponse -> Maybe Device
device :: Prelude.Maybe Device,
    -- | The response's http status code.
    CreateDeviceResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateDeviceResponse -> CreateDeviceResponse -> Bool
(CreateDeviceResponse -> CreateDeviceResponse -> Bool)
-> (CreateDeviceResponse -> CreateDeviceResponse -> Bool)
-> Eq CreateDeviceResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDeviceResponse -> CreateDeviceResponse -> Bool
$c/= :: CreateDeviceResponse -> CreateDeviceResponse -> Bool
== :: CreateDeviceResponse -> CreateDeviceResponse -> Bool
$c== :: CreateDeviceResponse -> CreateDeviceResponse -> Bool
Prelude.Eq, Int -> CreateDeviceResponse -> ShowS
[CreateDeviceResponse] -> ShowS
CreateDeviceResponse -> String
(Int -> CreateDeviceResponse -> ShowS)
-> (CreateDeviceResponse -> String)
-> ([CreateDeviceResponse] -> ShowS)
-> Show CreateDeviceResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDeviceResponse] -> ShowS
$cshowList :: [CreateDeviceResponse] -> ShowS
show :: CreateDeviceResponse -> String
$cshow :: CreateDeviceResponse -> String
showsPrec :: Int -> CreateDeviceResponse -> ShowS
$cshowsPrec :: Int -> CreateDeviceResponse -> ShowS
Prelude.Show, (forall x. CreateDeviceResponse -> Rep CreateDeviceResponse x)
-> (forall x. Rep CreateDeviceResponse x -> CreateDeviceResponse)
-> Generic CreateDeviceResponse
forall x. Rep CreateDeviceResponse x -> CreateDeviceResponse
forall x. CreateDeviceResponse -> Rep CreateDeviceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateDeviceResponse x -> CreateDeviceResponse
$cfrom :: forall x. CreateDeviceResponse -> Rep CreateDeviceResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateDeviceResponse' 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:
--
-- 'device', 'createDeviceResponse_device' - Information about the device.
--
-- 'httpStatus', 'createDeviceResponse_httpStatus' - The response's http status code.
newCreateDeviceResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateDeviceResponse
newCreateDeviceResponse :: Int -> CreateDeviceResponse
newCreateDeviceResponse Int
pHttpStatus_ =
  CreateDeviceResponse' :: Maybe Device -> Int -> CreateDeviceResponse
CreateDeviceResponse'
    { $sel:device:CreateDeviceResponse' :: Maybe Device
device = Maybe Device
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateDeviceResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Information about the device.
createDeviceResponse_device :: Lens.Lens' CreateDeviceResponse (Prelude.Maybe Device)
createDeviceResponse_device :: (Maybe Device -> f (Maybe Device))
-> CreateDeviceResponse -> f CreateDeviceResponse
createDeviceResponse_device = (CreateDeviceResponse -> Maybe Device)
-> (CreateDeviceResponse -> Maybe Device -> CreateDeviceResponse)
-> Lens
     CreateDeviceResponse
     CreateDeviceResponse
     (Maybe Device)
     (Maybe Device)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDeviceResponse' {Maybe Device
device :: Maybe Device
$sel:device:CreateDeviceResponse' :: CreateDeviceResponse -> Maybe Device
device} -> Maybe Device
device) (\s :: CreateDeviceResponse
s@CreateDeviceResponse' {} Maybe Device
a -> CreateDeviceResponse
s {$sel:device:CreateDeviceResponse' :: Maybe Device
device = Maybe Device
a} :: CreateDeviceResponse)

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

instance Prelude.NFData CreateDeviceResponse