{-# 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.SageMaker.Types.PipelineDefinitionS3Location
-- 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.SageMaker.Types.PipelineDefinitionS3Location 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

-- | The location of the pipeline definition stored in Amazon S3.
--
-- /See:/ 'newPipelineDefinitionS3Location' smart constructor.
data PipelineDefinitionS3Location = PipelineDefinitionS3Location'
  { -- | Version Id of the pipeline definition file. If not specified, Amazon
    -- SageMaker will retrieve the latest version.
    PipelineDefinitionS3Location -> Maybe Text
versionId :: Prelude.Maybe Prelude.Text,
    -- | Name of the S3 bucket.
    PipelineDefinitionS3Location -> Text
bucket :: Prelude.Text,
    -- | The object key (or key name) uniquely identifies the object in an S3
    -- bucket.
    PipelineDefinitionS3Location -> Text
objectKey :: Prelude.Text
  }
  deriving (PipelineDefinitionS3Location
-> PipelineDefinitionS3Location -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PipelineDefinitionS3Location
-> PipelineDefinitionS3Location -> Bool
$c/= :: PipelineDefinitionS3Location
-> PipelineDefinitionS3Location -> Bool
== :: PipelineDefinitionS3Location
-> PipelineDefinitionS3Location -> Bool
$c== :: PipelineDefinitionS3Location
-> PipelineDefinitionS3Location -> Bool
Prelude.Eq, ReadPrec [PipelineDefinitionS3Location]
ReadPrec PipelineDefinitionS3Location
Int -> ReadS PipelineDefinitionS3Location
ReadS [PipelineDefinitionS3Location]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PipelineDefinitionS3Location]
$creadListPrec :: ReadPrec [PipelineDefinitionS3Location]
readPrec :: ReadPrec PipelineDefinitionS3Location
$creadPrec :: ReadPrec PipelineDefinitionS3Location
readList :: ReadS [PipelineDefinitionS3Location]
$creadList :: ReadS [PipelineDefinitionS3Location]
readsPrec :: Int -> ReadS PipelineDefinitionS3Location
$creadsPrec :: Int -> ReadS PipelineDefinitionS3Location
Prelude.Read, Int -> PipelineDefinitionS3Location -> ShowS
[PipelineDefinitionS3Location] -> ShowS
PipelineDefinitionS3Location -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PipelineDefinitionS3Location] -> ShowS
$cshowList :: [PipelineDefinitionS3Location] -> ShowS
show :: PipelineDefinitionS3Location -> String
$cshow :: PipelineDefinitionS3Location -> String
showsPrec :: Int -> PipelineDefinitionS3Location -> ShowS
$cshowsPrec :: Int -> PipelineDefinitionS3Location -> ShowS
Prelude.Show, forall x.
Rep PipelineDefinitionS3Location x -> PipelineDefinitionS3Location
forall x.
PipelineDefinitionS3Location -> Rep PipelineDefinitionS3Location x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PipelineDefinitionS3Location x -> PipelineDefinitionS3Location
$cfrom :: forall x.
PipelineDefinitionS3Location -> Rep PipelineDefinitionS3Location x
Prelude.Generic)

-- |
-- Create a value of 'PipelineDefinitionS3Location' 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:
--
-- 'versionId', 'pipelineDefinitionS3Location_versionId' - Version Id of the pipeline definition file. If not specified, Amazon
-- SageMaker will retrieve the latest version.
--
-- 'bucket', 'pipelineDefinitionS3Location_bucket' - Name of the S3 bucket.
--
-- 'objectKey', 'pipelineDefinitionS3Location_objectKey' - The object key (or key name) uniquely identifies the object in an S3
-- bucket.
newPipelineDefinitionS3Location ::
  -- | 'bucket'
  Prelude.Text ->
  -- | 'objectKey'
  Prelude.Text ->
  PipelineDefinitionS3Location
newPipelineDefinitionS3Location :: Text -> Text -> PipelineDefinitionS3Location
newPipelineDefinitionS3Location Text
pBucket_ Text
pObjectKey_ =
  PipelineDefinitionS3Location'
    { $sel:versionId:PipelineDefinitionS3Location' :: Maybe Text
versionId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:bucket:PipelineDefinitionS3Location' :: Text
bucket = Text
pBucket_,
      $sel:objectKey:PipelineDefinitionS3Location' :: Text
objectKey = Text
pObjectKey_
    }

-- | Version Id of the pipeline definition file. If not specified, Amazon
-- SageMaker will retrieve the latest version.
pipelineDefinitionS3Location_versionId :: Lens.Lens' PipelineDefinitionS3Location (Prelude.Maybe Prelude.Text)
pipelineDefinitionS3Location_versionId :: Lens' PipelineDefinitionS3Location (Maybe Text)
pipelineDefinitionS3Location_versionId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PipelineDefinitionS3Location' {Maybe Text
versionId :: Maybe Text
$sel:versionId:PipelineDefinitionS3Location' :: PipelineDefinitionS3Location -> Maybe Text
versionId} -> Maybe Text
versionId) (\s :: PipelineDefinitionS3Location
s@PipelineDefinitionS3Location' {} Maybe Text
a -> PipelineDefinitionS3Location
s {$sel:versionId:PipelineDefinitionS3Location' :: Maybe Text
versionId = Maybe Text
a} :: PipelineDefinitionS3Location)

-- | Name of the S3 bucket.
pipelineDefinitionS3Location_bucket :: Lens.Lens' PipelineDefinitionS3Location Prelude.Text
pipelineDefinitionS3Location_bucket :: Lens' PipelineDefinitionS3Location Text
pipelineDefinitionS3Location_bucket = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PipelineDefinitionS3Location' {Text
bucket :: Text
$sel:bucket:PipelineDefinitionS3Location' :: PipelineDefinitionS3Location -> Text
bucket} -> Text
bucket) (\s :: PipelineDefinitionS3Location
s@PipelineDefinitionS3Location' {} Text
a -> PipelineDefinitionS3Location
s {$sel:bucket:PipelineDefinitionS3Location' :: Text
bucket = Text
a} :: PipelineDefinitionS3Location)

-- | The object key (or key name) uniquely identifies the object in an S3
-- bucket.
pipelineDefinitionS3Location_objectKey :: Lens.Lens' PipelineDefinitionS3Location Prelude.Text
pipelineDefinitionS3Location_objectKey :: Lens' PipelineDefinitionS3Location Text
pipelineDefinitionS3Location_objectKey = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PipelineDefinitionS3Location' {Text
objectKey :: Text
$sel:objectKey:PipelineDefinitionS3Location' :: PipelineDefinitionS3Location -> Text
objectKey} -> Text
objectKey) (\s :: PipelineDefinitionS3Location
s@PipelineDefinitionS3Location' {} Text
a -> PipelineDefinitionS3Location
s {$sel:objectKey:PipelineDefinitionS3Location' :: Text
objectKey = Text
a} :: PipelineDefinitionS3Location)

instance
  Prelude.Hashable
    PipelineDefinitionS3Location
  where
  hashWithSalt :: Int -> PipelineDefinitionS3Location -> Int
hashWithSalt Int
_salt PipelineDefinitionS3Location' {Maybe Text
Text
objectKey :: Text
bucket :: Text
versionId :: Maybe Text
$sel:objectKey:PipelineDefinitionS3Location' :: PipelineDefinitionS3Location -> Text
$sel:bucket:PipelineDefinitionS3Location' :: PipelineDefinitionS3Location -> Text
$sel:versionId:PipelineDefinitionS3Location' :: PipelineDefinitionS3Location -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
versionId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
bucket
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
objectKey

instance Prelude.NFData PipelineDefinitionS3Location where
  rnf :: PipelineDefinitionS3Location -> ()
rnf PipelineDefinitionS3Location' {Maybe Text
Text
objectKey :: Text
bucket :: Text
versionId :: Maybe Text
$sel:objectKey:PipelineDefinitionS3Location' :: PipelineDefinitionS3Location -> Text
$sel:bucket:PipelineDefinitionS3Location' :: PipelineDefinitionS3Location -> Text
$sel:versionId:PipelineDefinitionS3Location' :: PipelineDefinitionS3Location -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
versionId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
bucket
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
objectKey

instance Data.ToJSON PipelineDefinitionS3Location where
  toJSON :: PipelineDefinitionS3Location -> Value
toJSON PipelineDefinitionS3Location' {Maybe Text
Text
objectKey :: Text
bucket :: Text
versionId :: Maybe Text
$sel:objectKey:PipelineDefinitionS3Location' :: PipelineDefinitionS3Location -> Text
$sel:bucket:PipelineDefinitionS3Location' :: PipelineDefinitionS3Location -> Text
$sel:versionId:PipelineDefinitionS3Location' :: PipelineDefinitionS3Location -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"VersionId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
versionId,
            forall a. a -> Maybe a
Prelude.Just (Key
"Bucket" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
bucket),
            forall a. a -> Maybe a
Prelude.Just (Key
"ObjectKey" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
objectKey)
          ]
      )