{-# 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.DataSync.Types.LocationListEntry
-- 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)
module Amazonka.DataSync.Types.LocationListEntry where

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

-- | Represents a single entry in a list of locations. @LocationListEntry@
-- returns an array that contains a list of locations when the
-- <https://docs.aws.amazon.com/datasync/latest/userguide/API_ListLocations.html ListLocations>
-- operation is called.
--
-- /See:/ 'newLocationListEntry' smart constructor.
data LocationListEntry = LocationListEntry'
  { -- | Represents a list of URLs of a location. @LocationUri@ returns an array
    -- that contains a list of locations when the
    -- <https://docs.aws.amazon.com/datasync/latest/userguide/API_ListLocations.html ListLocations>
    -- operation is called.
    --
    -- Format: @TYPE:\/\/GLOBAL_ID\/SUBDIR@.
    --
    -- TYPE designates the type of location. Valid values: NFS | EFS | S3.
    --
    -- GLOBAL_ID is the globally unique identifier of the resource that backs
    -- the location. An example for EFS is @us-east-2.fs-abcd1234@. An example
    -- for Amazon S3 is the bucket name, such as @myBucket@. An example for NFS
    -- is a valid IPv4 address or a host name compliant with Domain Name
    -- Service (DNS).
    --
    -- SUBDIR is a valid file system path, delimited by forward slashes as is
    -- the *nix convention. For NFS and Amazon EFS, it\'s the export path to
    -- mount the location. For Amazon S3, it\'s the prefix path that you mount
    -- to and treat as the root of the location.
    LocationListEntry -> Maybe Text
locationUri :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the location. For Network File System
    -- (NFS) or Amazon EFS, the location is the export path. For Amazon S3, the
    -- location is the prefix path that you want to mount and use as the root
    -- of the location.
    LocationListEntry -> Maybe Text
locationArn :: Prelude.Maybe Prelude.Text
  }
  deriving (LocationListEntry -> LocationListEntry -> Bool
(LocationListEntry -> LocationListEntry -> Bool)
-> (LocationListEntry -> LocationListEntry -> Bool)
-> Eq LocationListEntry
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LocationListEntry -> LocationListEntry -> Bool
$c/= :: LocationListEntry -> LocationListEntry -> Bool
== :: LocationListEntry -> LocationListEntry -> Bool
$c== :: LocationListEntry -> LocationListEntry -> Bool
Prelude.Eq, ReadPrec [LocationListEntry]
ReadPrec LocationListEntry
Int -> ReadS LocationListEntry
ReadS [LocationListEntry]
(Int -> ReadS LocationListEntry)
-> ReadS [LocationListEntry]
-> ReadPrec LocationListEntry
-> ReadPrec [LocationListEntry]
-> Read LocationListEntry
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LocationListEntry]
$creadListPrec :: ReadPrec [LocationListEntry]
readPrec :: ReadPrec LocationListEntry
$creadPrec :: ReadPrec LocationListEntry
readList :: ReadS [LocationListEntry]
$creadList :: ReadS [LocationListEntry]
readsPrec :: Int -> ReadS LocationListEntry
$creadsPrec :: Int -> ReadS LocationListEntry
Prelude.Read, Int -> LocationListEntry -> ShowS
[LocationListEntry] -> ShowS
LocationListEntry -> String
(Int -> LocationListEntry -> ShowS)
-> (LocationListEntry -> String)
-> ([LocationListEntry] -> ShowS)
-> Show LocationListEntry
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LocationListEntry] -> ShowS
$cshowList :: [LocationListEntry] -> ShowS
show :: LocationListEntry -> String
$cshow :: LocationListEntry -> String
showsPrec :: Int -> LocationListEntry -> ShowS
$cshowsPrec :: Int -> LocationListEntry -> ShowS
Prelude.Show, (forall x. LocationListEntry -> Rep LocationListEntry x)
-> (forall x. Rep LocationListEntry x -> LocationListEntry)
-> Generic LocationListEntry
forall x. Rep LocationListEntry x -> LocationListEntry
forall x. LocationListEntry -> Rep LocationListEntry x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LocationListEntry x -> LocationListEntry
$cfrom :: forall x. LocationListEntry -> Rep LocationListEntry x
Prelude.Generic)

-- |
-- Create a value of 'LocationListEntry' 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:
--
-- 'locationUri', 'locationListEntry_locationUri' - Represents a list of URLs of a location. @LocationUri@ returns an array
-- that contains a list of locations when the
-- <https://docs.aws.amazon.com/datasync/latest/userguide/API_ListLocations.html ListLocations>
-- operation is called.
--
-- Format: @TYPE:\/\/GLOBAL_ID\/SUBDIR@.
--
-- TYPE designates the type of location. Valid values: NFS | EFS | S3.
--
-- GLOBAL_ID is the globally unique identifier of the resource that backs
-- the location. An example for EFS is @us-east-2.fs-abcd1234@. An example
-- for Amazon S3 is the bucket name, such as @myBucket@. An example for NFS
-- is a valid IPv4 address or a host name compliant with Domain Name
-- Service (DNS).
--
-- SUBDIR is a valid file system path, delimited by forward slashes as is
-- the *nix convention. For NFS and Amazon EFS, it\'s the export path to
-- mount the location. For Amazon S3, it\'s the prefix path that you mount
-- to and treat as the root of the location.
--
-- 'locationArn', 'locationListEntry_locationArn' - The Amazon Resource Name (ARN) of the location. For Network File System
-- (NFS) or Amazon EFS, the location is the export path. For Amazon S3, the
-- location is the prefix path that you want to mount and use as the root
-- of the location.
newLocationListEntry ::
  LocationListEntry
newLocationListEntry :: LocationListEntry
newLocationListEntry =
  LocationListEntry' :: Maybe Text -> Maybe Text -> LocationListEntry
LocationListEntry'
    { $sel:locationUri:LocationListEntry' :: Maybe Text
locationUri = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:locationArn:LocationListEntry' :: Maybe Text
locationArn = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Represents a list of URLs of a location. @LocationUri@ returns an array
-- that contains a list of locations when the
-- <https://docs.aws.amazon.com/datasync/latest/userguide/API_ListLocations.html ListLocations>
-- operation is called.
--
-- Format: @TYPE:\/\/GLOBAL_ID\/SUBDIR@.
--
-- TYPE designates the type of location. Valid values: NFS | EFS | S3.
--
-- GLOBAL_ID is the globally unique identifier of the resource that backs
-- the location. An example for EFS is @us-east-2.fs-abcd1234@. An example
-- for Amazon S3 is the bucket name, such as @myBucket@. An example for NFS
-- is a valid IPv4 address or a host name compliant with Domain Name
-- Service (DNS).
--
-- SUBDIR is a valid file system path, delimited by forward slashes as is
-- the *nix convention. For NFS and Amazon EFS, it\'s the export path to
-- mount the location. For Amazon S3, it\'s the prefix path that you mount
-- to and treat as the root of the location.
locationListEntry_locationUri :: Lens.Lens' LocationListEntry (Prelude.Maybe Prelude.Text)
locationListEntry_locationUri :: (Maybe Text -> f (Maybe Text))
-> LocationListEntry -> f LocationListEntry
locationListEntry_locationUri = (LocationListEntry -> Maybe Text)
-> (LocationListEntry -> Maybe Text -> LocationListEntry)
-> Lens
     LocationListEntry LocationListEntry (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LocationListEntry' {Maybe Text
locationUri :: Maybe Text
$sel:locationUri:LocationListEntry' :: LocationListEntry -> Maybe Text
locationUri} -> Maybe Text
locationUri) (\s :: LocationListEntry
s@LocationListEntry' {} Maybe Text
a -> LocationListEntry
s {$sel:locationUri:LocationListEntry' :: Maybe Text
locationUri = Maybe Text
a} :: LocationListEntry)

-- | The Amazon Resource Name (ARN) of the location. For Network File System
-- (NFS) or Amazon EFS, the location is the export path. For Amazon S3, the
-- location is the prefix path that you want to mount and use as the root
-- of the location.
locationListEntry_locationArn :: Lens.Lens' LocationListEntry (Prelude.Maybe Prelude.Text)
locationListEntry_locationArn :: (Maybe Text -> f (Maybe Text))
-> LocationListEntry -> f LocationListEntry
locationListEntry_locationArn = (LocationListEntry -> Maybe Text)
-> (LocationListEntry -> Maybe Text -> LocationListEntry)
-> Lens
     LocationListEntry LocationListEntry (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LocationListEntry' {Maybe Text
locationArn :: Maybe Text
$sel:locationArn:LocationListEntry' :: LocationListEntry -> Maybe Text
locationArn} -> Maybe Text
locationArn) (\s :: LocationListEntry
s@LocationListEntry' {} Maybe Text
a -> LocationListEntry
s {$sel:locationArn:LocationListEntry' :: Maybe Text
locationArn = Maybe Text
a} :: LocationListEntry)

instance Core.FromJSON LocationListEntry where
  parseJSON :: Value -> Parser LocationListEntry
parseJSON =
    String
-> (Object -> Parser LocationListEntry)
-> Value
-> Parser LocationListEntry
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"LocationListEntry"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> LocationListEntry
LocationListEntry'
            (Maybe Text -> Maybe Text -> LocationListEntry)
-> Parser (Maybe Text) -> Parser (Maybe Text -> LocationListEntry)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LocationUri")
            Parser (Maybe Text -> LocationListEntry)
-> Parser (Maybe Text) -> Parser LocationListEntry
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LocationArn")
      )

instance Prelude.Hashable LocationListEntry

instance Prelude.NFData LocationListEntry