{-# 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.IoTSiteWise.CreateAsset
-- 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 an asset from an existing asset model. For more information, see
-- <https://docs.aws.amazon.com/iot-sitewise/latest/userguide/create-assets.html Creating assets>
-- in the /IoT SiteWise User Guide/.
module Amazonka.IoTSiteWise.CreateAsset
  ( -- * Creating a Request
    CreateAsset (..),
    newCreateAsset,

    -- * Request Lenses
    createAsset_clientToken,
    createAsset_tags,
    createAsset_assetName,
    createAsset_assetModelId,

    -- * Destructuring the Response
    CreateAssetResponse (..),
    newCreateAssetResponse,

    -- * Response Lenses
    createAssetResponse_httpStatus,
    createAssetResponse_assetId,
    createAssetResponse_assetArn,
    createAssetResponse_assetStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.IoTSiteWise.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:/ 'newCreateAsset' smart constructor.
data CreateAsset = CreateAsset'
  { -- | A unique case-sensitive identifier that you can provide to ensure the
    -- idempotency of the request. Don\'t reuse this client token if a new
    -- idempotent request is required.
    CreateAsset -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
    -- | A list of key-value pairs that contain metadata for the asset. For more
    -- information, see
    -- <https://docs.aws.amazon.com/iot-sitewise/latest/userguide/tag-resources.html Tagging your IoT SiteWise resources>
    -- in the /IoT SiteWise User Guide/.
    CreateAsset -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | A unique, friendly name for the asset.
    CreateAsset -> Text
assetName :: Prelude.Text,
    -- | The ID of the asset model from which to create the asset.
    CreateAsset -> Text
assetModelId :: Prelude.Text
  }
  deriving (CreateAsset -> CreateAsset -> Bool
(CreateAsset -> CreateAsset -> Bool)
-> (CreateAsset -> CreateAsset -> Bool) -> Eq CreateAsset
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateAsset -> CreateAsset -> Bool
$c/= :: CreateAsset -> CreateAsset -> Bool
== :: CreateAsset -> CreateAsset -> Bool
$c== :: CreateAsset -> CreateAsset -> Bool
Prelude.Eq, ReadPrec [CreateAsset]
ReadPrec CreateAsset
Int -> ReadS CreateAsset
ReadS [CreateAsset]
(Int -> ReadS CreateAsset)
-> ReadS [CreateAsset]
-> ReadPrec CreateAsset
-> ReadPrec [CreateAsset]
-> Read CreateAsset
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateAsset]
$creadListPrec :: ReadPrec [CreateAsset]
readPrec :: ReadPrec CreateAsset
$creadPrec :: ReadPrec CreateAsset
readList :: ReadS [CreateAsset]
$creadList :: ReadS [CreateAsset]
readsPrec :: Int -> ReadS CreateAsset
$creadsPrec :: Int -> ReadS CreateAsset
Prelude.Read, Int -> CreateAsset -> ShowS
[CreateAsset] -> ShowS
CreateAsset -> String
(Int -> CreateAsset -> ShowS)
-> (CreateAsset -> String)
-> ([CreateAsset] -> ShowS)
-> Show CreateAsset
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateAsset] -> ShowS
$cshowList :: [CreateAsset] -> ShowS
show :: CreateAsset -> String
$cshow :: CreateAsset -> String
showsPrec :: Int -> CreateAsset -> ShowS
$cshowsPrec :: Int -> CreateAsset -> ShowS
Prelude.Show, (forall x. CreateAsset -> Rep CreateAsset x)
-> (forall x. Rep CreateAsset x -> CreateAsset)
-> Generic CreateAsset
forall x. Rep CreateAsset x -> CreateAsset
forall x. CreateAsset -> Rep CreateAsset x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateAsset x -> CreateAsset
$cfrom :: forall x. CreateAsset -> Rep CreateAsset x
Prelude.Generic)

-- |
-- Create a value of 'CreateAsset' 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:
--
-- 'clientToken', 'createAsset_clientToken' - A unique case-sensitive identifier that you can provide to ensure the
-- idempotency of the request. Don\'t reuse this client token if a new
-- idempotent request is required.
--
-- 'tags', 'createAsset_tags' - A list of key-value pairs that contain metadata for the asset. For more
-- information, see
-- <https://docs.aws.amazon.com/iot-sitewise/latest/userguide/tag-resources.html Tagging your IoT SiteWise resources>
-- in the /IoT SiteWise User Guide/.
--
-- 'assetName', 'createAsset_assetName' - A unique, friendly name for the asset.
--
-- 'assetModelId', 'createAsset_assetModelId' - The ID of the asset model from which to create the asset.
newCreateAsset ::
  -- | 'assetName'
  Prelude.Text ->
  -- | 'assetModelId'
  Prelude.Text ->
  CreateAsset
newCreateAsset :: Text -> Text -> CreateAsset
newCreateAsset Text
pAssetName_ Text
pAssetModelId_ =
  CreateAsset' :: Maybe Text
-> Maybe (HashMap Text Text) -> Text -> Text -> CreateAsset
CreateAsset'
    { $sel:clientToken:CreateAsset' :: Maybe Text
clientToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:CreateAsset' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:assetName:CreateAsset' :: Text
assetName = Text
pAssetName_,
      $sel:assetModelId:CreateAsset' :: Text
assetModelId = Text
pAssetModelId_
    }

-- | A unique case-sensitive identifier that you can provide to ensure the
-- idempotency of the request. Don\'t reuse this client token if a new
-- idempotent request is required.
createAsset_clientToken :: Lens.Lens' CreateAsset (Prelude.Maybe Prelude.Text)
createAsset_clientToken :: (Maybe Text -> f (Maybe Text)) -> CreateAsset -> f CreateAsset
createAsset_clientToken = (CreateAsset -> Maybe Text)
-> (CreateAsset -> Maybe Text -> CreateAsset)
-> Lens CreateAsset CreateAsset (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAsset' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:CreateAsset' :: CreateAsset -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: CreateAsset
s@CreateAsset' {} Maybe Text
a -> CreateAsset
s {$sel:clientToken:CreateAsset' :: Maybe Text
clientToken = Maybe Text
a} :: CreateAsset)

-- | A list of key-value pairs that contain metadata for the asset. For more
-- information, see
-- <https://docs.aws.amazon.com/iot-sitewise/latest/userguide/tag-resources.html Tagging your IoT SiteWise resources>
-- in the /IoT SiteWise User Guide/.
createAsset_tags :: Lens.Lens' CreateAsset (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createAsset_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateAsset -> f CreateAsset
createAsset_tags = (CreateAsset -> Maybe (HashMap Text Text))
-> (CreateAsset -> Maybe (HashMap Text Text) -> CreateAsset)
-> Lens
     CreateAsset
     CreateAsset
     (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 (\CreateAsset' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateAsset' :: CreateAsset -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateAsset
s@CreateAsset' {} Maybe (HashMap Text Text)
a -> CreateAsset
s {$sel:tags:CreateAsset' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateAsset) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> CreateAsset -> f CreateAsset)
-> ((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)))
-> CreateAsset
-> f CreateAsset
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 unique, friendly name for the asset.
createAsset_assetName :: Lens.Lens' CreateAsset Prelude.Text
createAsset_assetName :: (Text -> f Text) -> CreateAsset -> f CreateAsset
createAsset_assetName = (CreateAsset -> Text)
-> (CreateAsset -> Text -> CreateAsset)
-> Lens CreateAsset CreateAsset Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAsset' {Text
assetName :: Text
$sel:assetName:CreateAsset' :: CreateAsset -> Text
assetName} -> Text
assetName) (\s :: CreateAsset
s@CreateAsset' {} Text
a -> CreateAsset
s {$sel:assetName:CreateAsset' :: Text
assetName = Text
a} :: CreateAsset)

-- | The ID of the asset model from which to create the asset.
createAsset_assetModelId :: Lens.Lens' CreateAsset Prelude.Text
createAsset_assetModelId :: (Text -> f Text) -> CreateAsset -> f CreateAsset
createAsset_assetModelId = (CreateAsset -> Text)
-> (CreateAsset -> Text -> CreateAsset)
-> Lens CreateAsset CreateAsset Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAsset' {Text
assetModelId :: Text
$sel:assetModelId:CreateAsset' :: CreateAsset -> Text
assetModelId} -> Text
assetModelId) (\s :: CreateAsset
s@CreateAsset' {} Text
a -> CreateAsset
s {$sel:assetModelId:CreateAsset' :: Text
assetModelId = Text
a} :: CreateAsset)

instance Core.AWSRequest CreateAsset where
  type AWSResponse CreateAsset = CreateAssetResponse
  request :: CreateAsset -> Request CreateAsset
request = Service -> CreateAsset -> Request CreateAsset
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateAsset
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateAsset)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateAsset))
-> Logger
-> Service
-> Proxy CreateAsset
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateAsset)))
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 ->
          Int -> Text -> Text -> AssetStatus -> CreateAssetResponse
CreateAssetResponse'
            (Int -> Text -> Text -> AssetStatus -> CreateAssetResponse)
-> Either String Int
-> Either
     String (Text -> Text -> AssetStatus -> CreateAssetResponse)
forall (f :: * -> *) a b. Functor 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 -> Text -> AssetStatus -> CreateAssetResponse)
-> Either String Text
-> Either String (Text -> AssetStatus -> CreateAssetResponse)
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
"assetId")
            Either String (Text -> AssetStatus -> CreateAssetResponse)
-> Either String Text
-> Either String (AssetStatus -> CreateAssetResponse)
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
"assetArn")
            Either String (AssetStatus -> CreateAssetResponse)
-> Either String AssetStatus -> Either String CreateAssetResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String AssetStatus
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"assetStatus")
      )

instance Prelude.Hashable CreateAsset

instance Prelude.NFData CreateAsset

instance Core.ToHeaders CreateAsset where
  toHeaders :: CreateAsset -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateAsset -> 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 CreateAsset where
  toJSON :: CreateAsset -> Value
toJSON CreateAsset' {Maybe Text
Maybe (HashMap Text Text)
Text
assetModelId :: Text
assetName :: Text
tags :: Maybe (HashMap Text Text)
clientToken :: Maybe Text
$sel:assetModelId:CreateAsset' :: CreateAsset -> Text
$sel:assetName:CreateAsset' :: CreateAsset -> Text
$sel:tags:CreateAsset' :: CreateAsset -> Maybe (HashMap Text Text)
$sel:clientToken:CreateAsset' :: CreateAsset -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"clientToken" 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
clientToken,
            (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
"assetName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
assetName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"assetModelId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
assetModelId)
          ]
      )

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

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

-- | /See:/ 'newCreateAssetResponse' smart constructor.
data CreateAssetResponse = CreateAssetResponse'
  { -- | The response's http status code.
    CreateAssetResponse -> Int
httpStatus :: Prelude.Int,
    -- | The ID of the asset. This ID uniquely identifies the asset within IoT
    -- SiteWise and can be used with other IoT SiteWise APIs.
    CreateAssetResponse -> Text
assetId :: Prelude.Text,
    -- | The
    -- <https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html ARN>
    -- of the asset, which has the following format.
    --
    -- @arn:${Partition}:iotsitewise:${Region}:${Account}:asset\/${AssetId}@
    CreateAssetResponse -> Text
assetArn :: Prelude.Text,
    -- | The status of the asset, which contains a state (@CREATING@ after
    -- successfully calling this operation) and any error message.
    CreateAssetResponse -> AssetStatus
assetStatus :: AssetStatus
  }
  deriving (CreateAssetResponse -> CreateAssetResponse -> Bool
(CreateAssetResponse -> CreateAssetResponse -> Bool)
-> (CreateAssetResponse -> CreateAssetResponse -> Bool)
-> Eq CreateAssetResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateAssetResponse -> CreateAssetResponse -> Bool
$c/= :: CreateAssetResponse -> CreateAssetResponse -> Bool
== :: CreateAssetResponse -> CreateAssetResponse -> Bool
$c== :: CreateAssetResponse -> CreateAssetResponse -> Bool
Prelude.Eq, ReadPrec [CreateAssetResponse]
ReadPrec CreateAssetResponse
Int -> ReadS CreateAssetResponse
ReadS [CreateAssetResponse]
(Int -> ReadS CreateAssetResponse)
-> ReadS [CreateAssetResponse]
-> ReadPrec CreateAssetResponse
-> ReadPrec [CreateAssetResponse]
-> Read CreateAssetResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateAssetResponse]
$creadListPrec :: ReadPrec [CreateAssetResponse]
readPrec :: ReadPrec CreateAssetResponse
$creadPrec :: ReadPrec CreateAssetResponse
readList :: ReadS [CreateAssetResponse]
$creadList :: ReadS [CreateAssetResponse]
readsPrec :: Int -> ReadS CreateAssetResponse
$creadsPrec :: Int -> ReadS CreateAssetResponse
Prelude.Read, Int -> CreateAssetResponse -> ShowS
[CreateAssetResponse] -> ShowS
CreateAssetResponse -> String
(Int -> CreateAssetResponse -> ShowS)
-> (CreateAssetResponse -> String)
-> ([CreateAssetResponse] -> ShowS)
-> Show CreateAssetResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateAssetResponse] -> ShowS
$cshowList :: [CreateAssetResponse] -> ShowS
show :: CreateAssetResponse -> String
$cshow :: CreateAssetResponse -> String
showsPrec :: Int -> CreateAssetResponse -> ShowS
$cshowsPrec :: Int -> CreateAssetResponse -> ShowS
Prelude.Show, (forall x. CreateAssetResponse -> Rep CreateAssetResponse x)
-> (forall x. Rep CreateAssetResponse x -> CreateAssetResponse)
-> Generic CreateAssetResponse
forall x. Rep CreateAssetResponse x -> CreateAssetResponse
forall x. CreateAssetResponse -> Rep CreateAssetResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateAssetResponse x -> CreateAssetResponse
$cfrom :: forall x. CreateAssetResponse -> Rep CreateAssetResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateAssetResponse' 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:
--
-- 'httpStatus', 'createAssetResponse_httpStatus' - The response's http status code.
--
-- 'assetId', 'createAssetResponse_assetId' - The ID of the asset. This ID uniquely identifies the asset within IoT
-- SiteWise and can be used with other IoT SiteWise APIs.
--
-- 'assetArn', 'createAssetResponse_assetArn' - The
-- <https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html ARN>
-- of the asset, which has the following format.
--
-- @arn:${Partition}:iotsitewise:${Region}:${Account}:asset\/${AssetId}@
--
-- 'assetStatus', 'createAssetResponse_assetStatus' - The status of the asset, which contains a state (@CREATING@ after
-- successfully calling this operation) and any error message.
newCreateAssetResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'assetId'
  Prelude.Text ->
  -- | 'assetArn'
  Prelude.Text ->
  -- | 'assetStatus'
  AssetStatus ->
  CreateAssetResponse
newCreateAssetResponse :: Int -> Text -> Text -> AssetStatus -> CreateAssetResponse
newCreateAssetResponse
  Int
pHttpStatus_
  Text
pAssetId_
  Text
pAssetArn_
  AssetStatus
pAssetStatus_ =
    CreateAssetResponse' :: Int -> Text -> Text -> AssetStatus -> CreateAssetResponse
CreateAssetResponse'
      { $sel:httpStatus:CreateAssetResponse' :: Int
httpStatus = Int
pHttpStatus_,
        $sel:assetId:CreateAssetResponse' :: Text
assetId = Text
pAssetId_,
        $sel:assetArn:CreateAssetResponse' :: Text
assetArn = Text
pAssetArn_,
        $sel:assetStatus:CreateAssetResponse' :: AssetStatus
assetStatus = AssetStatus
pAssetStatus_
      }

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

-- | The ID of the asset. This ID uniquely identifies the asset within IoT
-- SiteWise and can be used with other IoT SiteWise APIs.
createAssetResponse_assetId :: Lens.Lens' CreateAssetResponse Prelude.Text
createAssetResponse_assetId :: (Text -> f Text) -> CreateAssetResponse -> f CreateAssetResponse
createAssetResponse_assetId = (CreateAssetResponse -> Text)
-> (CreateAssetResponse -> Text -> CreateAssetResponse)
-> Lens CreateAssetResponse CreateAssetResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAssetResponse' {Text
assetId :: Text
$sel:assetId:CreateAssetResponse' :: CreateAssetResponse -> Text
assetId} -> Text
assetId) (\s :: CreateAssetResponse
s@CreateAssetResponse' {} Text
a -> CreateAssetResponse
s {$sel:assetId:CreateAssetResponse' :: Text
assetId = Text
a} :: CreateAssetResponse)

-- | The
-- <https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html ARN>
-- of the asset, which has the following format.
--
-- @arn:${Partition}:iotsitewise:${Region}:${Account}:asset\/${AssetId}@
createAssetResponse_assetArn :: Lens.Lens' CreateAssetResponse Prelude.Text
createAssetResponse_assetArn :: (Text -> f Text) -> CreateAssetResponse -> f CreateAssetResponse
createAssetResponse_assetArn = (CreateAssetResponse -> Text)
-> (CreateAssetResponse -> Text -> CreateAssetResponse)
-> Lens CreateAssetResponse CreateAssetResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAssetResponse' {Text
assetArn :: Text
$sel:assetArn:CreateAssetResponse' :: CreateAssetResponse -> Text
assetArn} -> Text
assetArn) (\s :: CreateAssetResponse
s@CreateAssetResponse' {} Text
a -> CreateAssetResponse
s {$sel:assetArn:CreateAssetResponse' :: Text
assetArn = Text
a} :: CreateAssetResponse)

-- | The status of the asset, which contains a state (@CREATING@ after
-- successfully calling this operation) and any error message.
createAssetResponse_assetStatus :: Lens.Lens' CreateAssetResponse AssetStatus
createAssetResponse_assetStatus :: (AssetStatus -> f AssetStatus)
-> CreateAssetResponse -> f CreateAssetResponse
createAssetResponse_assetStatus = (CreateAssetResponse -> AssetStatus)
-> (CreateAssetResponse -> AssetStatus -> CreateAssetResponse)
-> Lens
     CreateAssetResponse CreateAssetResponse AssetStatus AssetStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAssetResponse' {AssetStatus
assetStatus :: AssetStatus
$sel:assetStatus:CreateAssetResponse' :: CreateAssetResponse -> AssetStatus
assetStatus} -> AssetStatus
assetStatus) (\s :: CreateAssetResponse
s@CreateAssetResponse' {} AssetStatus
a -> CreateAssetResponse
s {$sel:assetStatus:CreateAssetResponse' :: AssetStatus
assetStatus = AssetStatus
a} :: CreateAssetResponse)

instance Prelude.NFData CreateAssetResponse