{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# 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.Types.CustomerManagedS3Storage
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.IoTSiteWise.Types.CustomerManagedS3Storage where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | Contains information about a customer managed Amazon S3 bucket.
--
-- /See:/ 'newCustomerManagedS3Storage' smart constructor.
data CustomerManagedS3Storage = CustomerManagedS3Storage'
  { -- | The
    -- <https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html ARN>
    -- of the Amazon S3 object. For more information about how to find the ARN
    -- for an Amazon S3 object, see
    -- <https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-arn-format.html Amazon S3 resources>
    -- in the /Amazon Simple Storage Service User Guide/.
    CustomerManagedS3Storage -> Text
s3ResourceArn :: Prelude.Text,
    -- | The
    -- <https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html ARN>
    -- of the Identity and Access Management role that allows IoT SiteWise to
    -- send data to Amazon S3.
    CustomerManagedS3Storage -> Text
roleArn :: Prelude.Text
  }
  deriving (CustomerManagedS3Storage -> CustomerManagedS3Storage -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CustomerManagedS3Storage -> CustomerManagedS3Storage -> Bool
$c/= :: CustomerManagedS3Storage -> CustomerManagedS3Storage -> Bool
== :: CustomerManagedS3Storage -> CustomerManagedS3Storage -> Bool
$c== :: CustomerManagedS3Storage -> CustomerManagedS3Storage -> Bool
Prelude.Eq, ReadPrec [CustomerManagedS3Storage]
ReadPrec CustomerManagedS3Storage
Int -> ReadS CustomerManagedS3Storage
ReadS [CustomerManagedS3Storage]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CustomerManagedS3Storage]
$creadListPrec :: ReadPrec [CustomerManagedS3Storage]
readPrec :: ReadPrec CustomerManagedS3Storage
$creadPrec :: ReadPrec CustomerManagedS3Storage
readList :: ReadS [CustomerManagedS3Storage]
$creadList :: ReadS [CustomerManagedS3Storage]
readsPrec :: Int -> ReadS CustomerManagedS3Storage
$creadsPrec :: Int -> ReadS CustomerManagedS3Storage
Prelude.Read, Int -> CustomerManagedS3Storage -> ShowS
[CustomerManagedS3Storage] -> ShowS
CustomerManagedS3Storage -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CustomerManagedS3Storage] -> ShowS
$cshowList :: [CustomerManagedS3Storage] -> ShowS
show :: CustomerManagedS3Storage -> String
$cshow :: CustomerManagedS3Storage -> String
showsPrec :: Int -> CustomerManagedS3Storage -> ShowS
$cshowsPrec :: Int -> CustomerManagedS3Storage -> ShowS
Prelude.Show, forall x.
Rep CustomerManagedS3Storage x -> CustomerManagedS3Storage
forall x.
CustomerManagedS3Storage -> Rep CustomerManagedS3Storage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CustomerManagedS3Storage x -> CustomerManagedS3Storage
$cfrom :: forall x.
CustomerManagedS3Storage -> Rep CustomerManagedS3Storage x
Prelude.Generic)

-- |
-- Create a value of 'CustomerManagedS3Storage' 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:
--
-- 's3ResourceArn', 'customerManagedS3Storage_s3ResourceArn' - The
-- <https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html ARN>
-- of the Amazon S3 object. For more information about how to find the ARN
-- for an Amazon S3 object, see
-- <https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-arn-format.html Amazon S3 resources>
-- in the /Amazon Simple Storage Service User Guide/.
--
-- 'roleArn', 'customerManagedS3Storage_roleArn' - The
-- <https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html ARN>
-- of the Identity and Access Management role that allows IoT SiteWise to
-- send data to Amazon S3.
newCustomerManagedS3Storage ::
  -- | 's3ResourceArn'
  Prelude.Text ->
  -- | 'roleArn'
  Prelude.Text ->
  CustomerManagedS3Storage
newCustomerManagedS3Storage :: Text -> Text -> CustomerManagedS3Storage
newCustomerManagedS3Storage Text
pS3ResourceArn_ Text
pRoleArn_ =
  CustomerManagedS3Storage'
    { $sel:s3ResourceArn:CustomerManagedS3Storage' :: Text
s3ResourceArn =
        Text
pS3ResourceArn_,
      $sel:roleArn:CustomerManagedS3Storage' :: Text
roleArn = Text
pRoleArn_
    }

-- | The
-- <https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html ARN>
-- of the Amazon S3 object. For more information about how to find the ARN
-- for an Amazon S3 object, see
-- <https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-arn-format.html Amazon S3 resources>
-- in the /Amazon Simple Storage Service User Guide/.
customerManagedS3Storage_s3ResourceArn :: Lens.Lens' CustomerManagedS3Storage Prelude.Text
customerManagedS3Storage_s3ResourceArn :: Lens' CustomerManagedS3Storage Text
customerManagedS3Storage_s3ResourceArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomerManagedS3Storage' {Text
s3ResourceArn :: Text
$sel:s3ResourceArn:CustomerManagedS3Storage' :: CustomerManagedS3Storage -> Text
s3ResourceArn} -> Text
s3ResourceArn) (\s :: CustomerManagedS3Storage
s@CustomerManagedS3Storage' {} Text
a -> CustomerManagedS3Storage
s {$sel:s3ResourceArn:CustomerManagedS3Storage' :: Text
s3ResourceArn = Text
a} :: CustomerManagedS3Storage)

-- | The
-- <https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html ARN>
-- of the Identity and Access Management role that allows IoT SiteWise to
-- send data to Amazon S3.
customerManagedS3Storage_roleArn :: Lens.Lens' CustomerManagedS3Storage Prelude.Text
customerManagedS3Storage_roleArn :: Lens' CustomerManagedS3Storage Text
customerManagedS3Storage_roleArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomerManagedS3Storage' {Text
roleArn :: Text
$sel:roleArn:CustomerManagedS3Storage' :: CustomerManagedS3Storage -> Text
roleArn} -> Text
roleArn) (\s :: CustomerManagedS3Storage
s@CustomerManagedS3Storage' {} Text
a -> CustomerManagedS3Storage
s {$sel:roleArn:CustomerManagedS3Storage' :: Text
roleArn = Text
a} :: CustomerManagedS3Storage)

instance Data.FromJSON CustomerManagedS3Storage where
  parseJSON :: Value -> Parser CustomerManagedS3Storage
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"CustomerManagedS3Storage"
      ( \Object
x ->
          Text -> Text -> CustomerManagedS3Storage
CustomerManagedS3Storage'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"s3ResourceArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"roleArn")
      )

instance Prelude.Hashable CustomerManagedS3Storage where
  hashWithSalt :: Int -> CustomerManagedS3Storage -> Int
hashWithSalt Int
_salt CustomerManagedS3Storage' {Text
roleArn :: Text
s3ResourceArn :: Text
$sel:roleArn:CustomerManagedS3Storage' :: CustomerManagedS3Storage -> Text
$sel:s3ResourceArn:CustomerManagedS3Storage' :: CustomerManagedS3Storage -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
s3ResourceArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
roleArn

instance Prelude.NFData CustomerManagedS3Storage where
  rnf :: CustomerManagedS3Storage -> ()
rnf CustomerManagedS3Storage' {Text
roleArn :: Text
s3ResourceArn :: Text
$sel:roleArn:CustomerManagedS3Storage' :: CustomerManagedS3Storage -> Text
$sel:s3ResourceArn:CustomerManagedS3Storage' :: CustomerManagedS3Storage -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
s3ResourceArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
roleArn

instance Data.ToJSON CustomerManagedS3Storage where
  toJSON :: CustomerManagedS3Storage -> Value
toJSON CustomerManagedS3Storage' {Text
roleArn :: Text
s3ResourceArn :: Text
$sel:roleArn:CustomerManagedS3Storage' :: CustomerManagedS3Storage -> Text
$sel:s3ResourceArn:CustomerManagedS3Storage' :: CustomerManagedS3Storage -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"s3ResourceArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
s3ResourceArn),
            forall a. a -> Maybe a
Prelude.Just (Key
"roleArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
roleArn)
          ]
      )