{-# 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.Panorama.ProvisionDevice
-- 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 device and returns a configuration archive. The configuration
-- archive is a ZIP file that contains a provisioning certificate that is
-- valid for 5 minutes. Transfer the configuration archive to the device
-- with the included USB storage device within 5 minutes.
module Amazonka.Panorama.ProvisionDevice
  ( -- * Creating a Request
    ProvisionDevice (..),
    newProvisionDevice,

    -- * Request Lenses
    provisionDevice_description,
    provisionDevice_networkingConfiguration,
    provisionDevice_tags,
    provisionDevice_name,

    -- * Destructuring the Response
    ProvisionDeviceResponse (..),
    newProvisionDeviceResponse,

    -- * Response Lenses
    provisionDeviceResponse_certificates,
    provisionDeviceResponse_deviceId,
    provisionDeviceResponse_iotThingName,
    provisionDeviceResponse_httpStatus,
    provisionDeviceResponse_arn,
    provisionDeviceResponse_status,
  )
where

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

-- | /See:/ 'newProvisionDevice' smart constructor.
data ProvisionDevice = ProvisionDevice'
  { -- | A description for the device.
    ProvisionDevice -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | A networking configuration for the device.
    ProvisionDevice -> Maybe NetworkPayload
networkingConfiguration :: Prelude.Maybe NetworkPayload,
    -- | Tags for the device.
    ProvisionDevice -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | A name for the device.
    ProvisionDevice -> Text
name :: Prelude.Text
  }
  deriving (ProvisionDevice -> ProvisionDevice -> Bool
(ProvisionDevice -> ProvisionDevice -> Bool)
-> (ProvisionDevice -> ProvisionDevice -> Bool)
-> Eq ProvisionDevice
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProvisionDevice -> ProvisionDevice -> Bool
$c/= :: ProvisionDevice -> ProvisionDevice -> Bool
== :: ProvisionDevice -> ProvisionDevice -> Bool
$c== :: ProvisionDevice -> ProvisionDevice -> Bool
Prelude.Eq, ReadPrec [ProvisionDevice]
ReadPrec ProvisionDevice
Int -> ReadS ProvisionDevice
ReadS [ProvisionDevice]
(Int -> ReadS ProvisionDevice)
-> ReadS [ProvisionDevice]
-> ReadPrec ProvisionDevice
-> ReadPrec [ProvisionDevice]
-> Read ProvisionDevice
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ProvisionDevice]
$creadListPrec :: ReadPrec [ProvisionDevice]
readPrec :: ReadPrec ProvisionDevice
$creadPrec :: ReadPrec ProvisionDevice
readList :: ReadS [ProvisionDevice]
$creadList :: ReadS [ProvisionDevice]
readsPrec :: Int -> ReadS ProvisionDevice
$creadsPrec :: Int -> ReadS ProvisionDevice
Prelude.Read, Int -> ProvisionDevice -> ShowS
[ProvisionDevice] -> ShowS
ProvisionDevice -> String
(Int -> ProvisionDevice -> ShowS)
-> (ProvisionDevice -> String)
-> ([ProvisionDevice] -> ShowS)
-> Show ProvisionDevice
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProvisionDevice] -> ShowS
$cshowList :: [ProvisionDevice] -> ShowS
show :: ProvisionDevice -> String
$cshow :: ProvisionDevice -> String
showsPrec :: Int -> ProvisionDevice -> ShowS
$cshowsPrec :: Int -> ProvisionDevice -> ShowS
Prelude.Show, (forall x. ProvisionDevice -> Rep ProvisionDevice x)
-> (forall x. Rep ProvisionDevice x -> ProvisionDevice)
-> Generic ProvisionDevice
forall x. Rep ProvisionDevice x -> ProvisionDevice
forall x. ProvisionDevice -> Rep ProvisionDevice x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ProvisionDevice x -> ProvisionDevice
$cfrom :: forall x. ProvisionDevice -> Rep ProvisionDevice x
Prelude.Generic)

-- |
-- Create a value of 'ProvisionDevice' 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:
--
-- 'description', 'provisionDevice_description' - A description for the device.
--
-- 'networkingConfiguration', 'provisionDevice_networkingConfiguration' - A networking configuration for the device.
--
-- 'tags', 'provisionDevice_tags' - Tags for the device.
--
-- 'name', 'provisionDevice_name' - A name for the device.
newProvisionDevice ::
  -- | 'name'
  Prelude.Text ->
  ProvisionDevice
newProvisionDevice :: Text -> ProvisionDevice
newProvisionDevice Text
pName_ =
  ProvisionDevice' :: Maybe Text
-> Maybe NetworkPayload
-> Maybe (HashMap Text Text)
-> Text
-> ProvisionDevice
ProvisionDevice'
    { $sel:description:ProvisionDevice' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:networkingConfiguration:ProvisionDevice' :: Maybe NetworkPayload
networkingConfiguration = Maybe NetworkPayload
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:ProvisionDevice' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:name:ProvisionDevice' :: Text
name = Text
pName_
    }

-- | A description for the device.
provisionDevice_description :: Lens.Lens' ProvisionDevice (Prelude.Maybe Prelude.Text)
provisionDevice_description :: (Maybe Text -> f (Maybe Text))
-> ProvisionDevice -> f ProvisionDevice
provisionDevice_description = (ProvisionDevice -> Maybe Text)
-> (ProvisionDevice -> Maybe Text -> ProvisionDevice)
-> Lens ProvisionDevice ProvisionDevice (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProvisionDevice' {Maybe Text
description :: Maybe Text
$sel:description:ProvisionDevice' :: ProvisionDevice -> Maybe Text
description} -> Maybe Text
description) (\s :: ProvisionDevice
s@ProvisionDevice' {} Maybe Text
a -> ProvisionDevice
s {$sel:description:ProvisionDevice' :: Maybe Text
description = Maybe Text
a} :: ProvisionDevice)

-- | A networking configuration for the device.
provisionDevice_networkingConfiguration :: Lens.Lens' ProvisionDevice (Prelude.Maybe NetworkPayload)
provisionDevice_networkingConfiguration :: (Maybe NetworkPayload -> f (Maybe NetworkPayload))
-> ProvisionDevice -> f ProvisionDevice
provisionDevice_networkingConfiguration = (ProvisionDevice -> Maybe NetworkPayload)
-> (ProvisionDevice -> Maybe NetworkPayload -> ProvisionDevice)
-> Lens
     ProvisionDevice
     ProvisionDevice
     (Maybe NetworkPayload)
     (Maybe NetworkPayload)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProvisionDevice' {Maybe NetworkPayload
networkingConfiguration :: Maybe NetworkPayload
$sel:networkingConfiguration:ProvisionDevice' :: ProvisionDevice -> Maybe NetworkPayload
networkingConfiguration} -> Maybe NetworkPayload
networkingConfiguration) (\s :: ProvisionDevice
s@ProvisionDevice' {} Maybe NetworkPayload
a -> ProvisionDevice
s {$sel:networkingConfiguration:ProvisionDevice' :: Maybe NetworkPayload
networkingConfiguration = Maybe NetworkPayload
a} :: ProvisionDevice)

-- | Tags for the device.
provisionDevice_tags :: Lens.Lens' ProvisionDevice (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
provisionDevice_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> ProvisionDevice -> f ProvisionDevice
provisionDevice_tags = (ProvisionDevice -> Maybe (HashMap Text Text))
-> (ProvisionDevice
    -> Maybe (HashMap Text Text) -> ProvisionDevice)
-> Lens
     ProvisionDevice
     ProvisionDevice
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProvisionDevice' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:ProvisionDevice' :: ProvisionDevice -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: ProvisionDevice
s@ProvisionDevice' {} Maybe (HashMap Text Text)
a -> ProvisionDevice
s {$sel:tags:ProvisionDevice' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: ProvisionDevice) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> ProvisionDevice -> f ProvisionDevice)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> ProvisionDevice
-> f ProvisionDevice
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text 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
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A name for the device.
provisionDevice_name :: Lens.Lens' ProvisionDevice Prelude.Text
provisionDevice_name :: (Text -> f Text) -> ProvisionDevice -> f ProvisionDevice
provisionDevice_name = (ProvisionDevice -> Text)
-> (ProvisionDevice -> Text -> ProvisionDevice)
-> Lens ProvisionDevice ProvisionDevice Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProvisionDevice' {Text
name :: Text
$sel:name:ProvisionDevice' :: ProvisionDevice -> Text
name} -> Text
name) (\s :: ProvisionDevice
s@ProvisionDevice' {} Text
a -> ProvisionDevice
s {$sel:name:ProvisionDevice' :: Text
name = Text
a} :: ProvisionDevice)

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

instance Prelude.Hashable ProvisionDevice

instance Prelude.NFData ProvisionDevice

instance Core.ToHeaders ProvisionDevice where
  toHeaders :: ProvisionDevice -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ProvisionDevice -> 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 ProvisionDevice where
  toJSON :: ProvisionDevice -> Value
toJSON ProvisionDevice' {Maybe Text
Maybe (HashMap Text Text)
Maybe NetworkPayload
Text
name :: Text
tags :: Maybe (HashMap Text Text)
networkingConfiguration :: Maybe NetworkPayload
description :: Maybe Text
$sel:name:ProvisionDevice' :: ProvisionDevice -> Text
$sel:tags:ProvisionDevice' :: ProvisionDevice -> Maybe (HashMap Text Text)
$sel:networkingConfiguration:ProvisionDevice' :: ProvisionDevice -> Maybe NetworkPayload
$sel:description:ProvisionDevice' :: ProvisionDevice -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (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
"NetworkingConfiguration" Text -> NetworkPayload -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (NetworkPayload -> Pair) -> Maybe NetworkPayload -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe NetworkPayload
networkingConfiguration,
            (Text
"Tags" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
tags,
            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)
          ]
      )

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

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

-- | /See:/ 'newProvisionDeviceResponse' smart constructor.
data ProvisionDeviceResponse = ProvisionDeviceResponse'
  { -- | The device\'s configuration bundle.
    ProvisionDeviceResponse -> Maybe Base64
certificates :: Prelude.Maybe Core.Base64,
    -- | The device\'s ID.
    ProvisionDeviceResponse -> Maybe Text
deviceId :: Prelude.Maybe Prelude.Text,
    -- | The device\'s IoT thing name.
    ProvisionDeviceResponse -> Maybe Text
iotThingName :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ProvisionDeviceResponse -> Int
httpStatus :: Prelude.Int,
    -- | The device\'s ARN.
    ProvisionDeviceResponse -> Text
arn :: Prelude.Text,
    -- | The device\'s status.
    ProvisionDeviceResponse -> DeviceStatus
status :: DeviceStatus
  }
  deriving (ProvisionDeviceResponse -> ProvisionDeviceResponse -> Bool
(ProvisionDeviceResponse -> ProvisionDeviceResponse -> Bool)
-> (ProvisionDeviceResponse -> ProvisionDeviceResponse -> Bool)
-> Eq ProvisionDeviceResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProvisionDeviceResponse -> ProvisionDeviceResponse -> Bool
$c/= :: ProvisionDeviceResponse -> ProvisionDeviceResponse -> Bool
== :: ProvisionDeviceResponse -> ProvisionDeviceResponse -> Bool
$c== :: ProvisionDeviceResponse -> ProvisionDeviceResponse -> Bool
Prelude.Eq, ReadPrec [ProvisionDeviceResponse]
ReadPrec ProvisionDeviceResponse
Int -> ReadS ProvisionDeviceResponse
ReadS [ProvisionDeviceResponse]
(Int -> ReadS ProvisionDeviceResponse)
-> ReadS [ProvisionDeviceResponse]
-> ReadPrec ProvisionDeviceResponse
-> ReadPrec [ProvisionDeviceResponse]
-> Read ProvisionDeviceResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ProvisionDeviceResponse]
$creadListPrec :: ReadPrec [ProvisionDeviceResponse]
readPrec :: ReadPrec ProvisionDeviceResponse
$creadPrec :: ReadPrec ProvisionDeviceResponse
readList :: ReadS [ProvisionDeviceResponse]
$creadList :: ReadS [ProvisionDeviceResponse]
readsPrec :: Int -> ReadS ProvisionDeviceResponse
$creadsPrec :: Int -> ReadS ProvisionDeviceResponse
Prelude.Read, Int -> ProvisionDeviceResponse -> ShowS
[ProvisionDeviceResponse] -> ShowS
ProvisionDeviceResponse -> String
(Int -> ProvisionDeviceResponse -> ShowS)
-> (ProvisionDeviceResponse -> String)
-> ([ProvisionDeviceResponse] -> ShowS)
-> Show ProvisionDeviceResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProvisionDeviceResponse] -> ShowS
$cshowList :: [ProvisionDeviceResponse] -> ShowS
show :: ProvisionDeviceResponse -> String
$cshow :: ProvisionDeviceResponse -> String
showsPrec :: Int -> ProvisionDeviceResponse -> ShowS
$cshowsPrec :: Int -> ProvisionDeviceResponse -> ShowS
Prelude.Show, (forall x.
 ProvisionDeviceResponse -> Rep ProvisionDeviceResponse x)
-> (forall x.
    Rep ProvisionDeviceResponse x -> ProvisionDeviceResponse)
-> Generic ProvisionDeviceResponse
forall x. Rep ProvisionDeviceResponse x -> ProvisionDeviceResponse
forall x. ProvisionDeviceResponse -> Rep ProvisionDeviceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ProvisionDeviceResponse x -> ProvisionDeviceResponse
$cfrom :: forall x. ProvisionDeviceResponse -> Rep ProvisionDeviceResponse x
Prelude.Generic)

-- |
-- Create a value of 'ProvisionDeviceResponse' 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:
--
-- 'certificates', 'provisionDeviceResponse_certificates' - The device\'s configuration bundle.--
-- -- /Note:/ This 'Lens' automatically encodes and decodes Base64 data.
-- -- The underlying isomorphism will encode to Base64 representation during
-- -- serialisation, and decode from Base64 representation during deserialisation.
-- -- This 'Lens' accepts and returns only raw unencoded data.
--
-- 'deviceId', 'provisionDeviceResponse_deviceId' - The device\'s ID.
--
-- 'iotThingName', 'provisionDeviceResponse_iotThingName' - The device\'s IoT thing name.
--
-- 'httpStatus', 'provisionDeviceResponse_httpStatus' - The response's http status code.
--
-- 'arn', 'provisionDeviceResponse_arn' - The device\'s ARN.
--
-- 'status', 'provisionDeviceResponse_status' - The device\'s status.
newProvisionDeviceResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'arn'
  Prelude.Text ->
  -- | 'status'
  DeviceStatus ->
  ProvisionDeviceResponse
newProvisionDeviceResponse :: Int -> Text -> DeviceStatus -> ProvisionDeviceResponse
newProvisionDeviceResponse
  Int
pHttpStatus_
  Text
pArn_
  DeviceStatus
pStatus_ =
    ProvisionDeviceResponse' :: Maybe Base64
-> Maybe Text
-> Maybe Text
-> Int
-> Text
-> DeviceStatus
-> ProvisionDeviceResponse
ProvisionDeviceResponse'
      { $sel:certificates:ProvisionDeviceResponse' :: Maybe Base64
certificates =
          Maybe Base64
forall a. Maybe a
Prelude.Nothing,
        $sel:deviceId:ProvisionDeviceResponse' :: Maybe Text
deviceId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:iotThingName:ProvisionDeviceResponse' :: Maybe Text
iotThingName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:ProvisionDeviceResponse' :: Int
httpStatus = Int
pHttpStatus_,
        $sel:arn:ProvisionDeviceResponse' :: Text
arn = Text
pArn_,
        $sel:status:ProvisionDeviceResponse' :: DeviceStatus
status = DeviceStatus
pStatus_
      }

-- | The device\'s configuration bundle.--
-- -- /Note:/ This 'Lens' automatically encodes and decodes Base64 data.
-- -- The underlying isomorphism will encode to Base64 representation during
-- -- serialisation, and decode from Base64 representation during deserialisation.
-- -- This 'Lens' accepts and returns only raw unencoded data.
provisionDeviceResponse_certificates :: Lens.Lens' ProvisionDeviceResponse (Prelude.Maybe Prelude.ByteString)
provisionDeviceResponse_certificates :: (Maybe ByteString -> f (Maybe ByteString))
-> ProvisionDeviceResponse -> f ProvisionDeviceResponse
provisionDeviceResponse_certificates = (ProvisionDeviceResponse -> Maybe Base64)
-> (ProvisionDeviceResponse
    -> Maybe Base64 -> ProvisionDeviceResponse)
-> Lens
     ProvisionDeviceResponse
     ProvisionDeviceResponse
     (Maybe Base64)
     (Maybe Base64)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProvisionDeviceResponse' {Maybe Base64
certificates :: Maybe Base64
$sel:certificates:ProvisionDeviceResponse' :: ProvisionDeviceResponse -> Maybe Base64
certificates} -> Maybe Base64
certificates) (\s :: ProvisionDeviceResponse
s@ProvisionDeviceResponse' {} Maybe Base64
a -> ProvisionDeviceResponse
s {$sel:certificates:ProvisionDeviceResponse' :: Maybe Base64
certificates = Maybe Base64
a} :: ProvisionDeviceResponse) ((Maybe Base64 -> f (Maybe Base64))
 -> ProvisionDeviceResponse -> f ProvisionDeviceResponse)
-> ((Maybe ByteString -> f (Maybe ByteString))
    -> Maybe Base64 -> f (Maybe Base64))
-> (Maybe ByteString -> f (Maybe ByteString))
-> ProvisionDeviceResponse
-> f ProvisionDeviceResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso Base64 Base64 ByteString ByteString
-> Iso
     (Maybe Base64) (Maybe Base64) (Maybe ByteString) (Maybe ByteString)
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 Base64 Base64 ByteString ByteString
Iso' Base64 ByteString
Core._Base64

-- | The device\'s ID.
provisionDeviceResponse_deviceId :: Lens.Lens' ProvisionDeviceResponse (Prelude.Maybe Prelude.Text)
provisionDeviceResponse_deviceId :: (Maybe Text -> f (Maybe Text))
-> ProvisionDeviceResponse -> f ProvisionDeviceResponse
provisionDeviceResponse_deviceId = (ProvisionDeviceResponse -> Maybe Text)
-> (ProvisionDeviceResponse
    -> Maybe Text -> ProvisionDeviceResponse)
-> Lens
     ProvisionDeviceResponse
     ProvisionDeviceResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProvisionDeviceResponse' {Maybe Text
deviceId :: Maybe Text
$sel:deviceId:ProvisionDeviceResponse' :: ProvisionDeviceResponse -> Maybe Text
deviceId} -> Maybe Text
deviceId) (\s :: ProvisionDeviceResponse
s@ProvisionDeviceResponse' {} Maybe Text
a -> ProvisionDeviceResponse
s {$sel:deviceId:ProvisionDeviceResponse' :: Maybe Text
deviceId = Maybe Text
a} :: ProvisionDeviceResponse)

-- | The device\'s IoT thing name.
provisionDeviceResponse_iotThingName :: Lens.Lens' ProvisionDeviceResponse (Prelude.Maybe Prelude.Text)
provisionDeviceResponse_iotThingName :: (Maybe Text -> f (Maybe Text))
-> ProvisionDeviceResponse -> f ProvisionDeviceResponse
provisionDeviceResponse_iotThingName = (ProvisionDeviceResponse -> Maybe Text)
-> (ProvisionDeviceResponse
    -> Maybe Text -> ProvisionDeviceResponse)
-> Lens
     ProvisionDeviceResponse
     ProvisionDeviceResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProvisionDeviceResponse' {Maybe Text
iotThingName :: Maybe Text
$sel:iotThingName:ProvisionDeviceResponse' :: ProvisionDeviceResponse -> Maybe Text
iotThingName} -> Maybe Text
iotThingName) (\s :: ProvisionDeviceResponse
s@ProvisionDeviceResponse' {} Maybe Text
a -> ProvisionDeviceResponse
s {$sel:iotThingName:ProvisionDeviceResponse' :: Maybe Text
iotThingName = Maybe Text
a} :: ProvisionDeviceResponse)

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

-- | The device\'s ARN.
provisionDeviceResponse_arn :: Lens.Lens' ProvisionDeviceResponse Prelude.Text
provisionDeviceResponse_arn :: (Text -> f Text)
-> ProvisionDeviceResponse -> f ProvisionDeviceResponse
provisionDeviceResponse_arn = (ProvisionDeviceResponse -> Text)
-> (ProvisionDeviceResponse -> Text -> ProvisionDeviceResponse)
-> Lens ProvisionDeviceResponse ProvisionDeviceResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProvisionDeviceResponse' {Text
arn :: Text
$sel:arn:ProvisionDeviceResponse' :: ProvisionDeviceResponse -> Text
arn} -> Text
arn) (\s :: ProvisionDeviceResponse
s@ProvisionDeviceResponse' {} Text
a -> ProvisionDeviceResponse
s {$sel:arn:ProvisionDeviceResponse' :: Text
arn = Text
a} :: ProvisionDeviceResponse)

-- | The device\'s status.
provisionDeviceResponse_status :: Lens.Lens' ProvisionDeviceResponse DeviceStatus
provisionDeviceResponse_status :: (DeviceStatus -> f DeviceStatus)
-> ProvisionDeviceResponse -> f ProvisionDeviceResponse
provisionDeviceResponse_status = (ProvisionDeviceResponse -> DeviceStatus)
-> (ProvisionDeviceResponse
    -> DeviceStatus -> ProvisionDeviceResponse)
-> Lens
     ProvisionDeviceResponse
     ProvisionDeviceResponse
     DeviceStatus
     DeviceStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProvisionDeviceResponse' {DeviceStatus
status :: DeviceStatus
$sel:status:ProvisionDeviceResponse' :: ProvisionDeviceResponse -> DeviceStatus
status} -> DeviceStatus
status) (\s :: ProvisionDeviceResponse
s@ProvisionDeviceResponse' {} DeviceStatus
a -> ProvisionDeviceResponse
s {$sel:status:ProvisionDeviceResponse' :: DeviceStatus
status = DeviceStatus
a} :: ProvisionDeviceResponse)

instance Prelude.NFData ProvisionDeviceResponse