{-# 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.AppMesh.Types.VirtualServiceRef
-- 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.AppMesh.Types.VirtualServiceRef where

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

-- | An object that represents a virtual service returned by a list
-- operation.
--
-- /See:/ 'newVirtualServiceRef' smart constructor.
data VirtualServiceRef = VirtualServiceRef'
  { -- | The full Amazon Resource Name (ARN) for the virtual service.
    VirtualServiceRef -> Text
arn :: Prelude.Text,
    -- | The Unix epoch timestamp in seconds for when the resource was created.
    VirtualServiceRef -> POSIX
createdAt :: Core.POSIX,
    -- | The Unix epoch timestamp in seconds for when the resource was last
    -- updated.
    VirtualServiceRef -> POSIX
lastUpdatedAt :: Core.POSIX,
    -- | The name of the service mesh that the virtual service resides in.
    VirtualServiceRef -> Text
meshName :: Prelude.Text,
    -- | The AWS IAM account ID of the service mesh owner. If the account ID is
    -- not your own, then it\'s the ID of the account that shared the mesh with
    -- your account. For more information about mesh sharing, see
    -- <https://docs.aws.amazon.com/app-mesh/latest/userguide/sharing.html Working with shared meshes>.
    VirtualServiceRef -> Text
meshOwner :: Prelude.Text,
    -- | The AWS IAM account ID of the resource owner. If the account ID is not
    -- your own, then it\'s the ID of the mesh owner or of another account that
    -- the mesh is shared with. For more information about mesh sharing, see
    -- <https://docs.aws.amazon.com/app-mesh/latest/userguide/sharing.html Working with shared meshes>.
    VirtualServiceRef -> Text
resourceOwner :: Prelude.Text,
    -- | The version of the resource. Resources are created at version 1, and
    -- this version is incremented each time that they\'re updated.
    VirtualServiceRef -> Integer
version :: Prelude.Integer,
    -- | The name of the virtual service.
    VirtualServiceRef -> Text
virtualServiceName :: Prelude.Text
  }
  deriving (VirtualServiceRef -> VirtualServiceRef -> Bool
(VirtualServiceRef -> VirtualServiceRef -> Bool)
-> (VirtualServiceRef -> VirtualServiceRef -> Bool)
-> Eq VirtualServiceRef
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VirtualServiceRef -> VirtualServiceRef -> Bool
$c/= :: VirtualServiceRef -> VirtualServiceRef -> Bool
== :: VirtualServiceRef -> VirtualServiceRef -> Bool
$c== :: VirtualServiceRef -> VirtualServiceRef -> Bool
Prelude.Eq, ReadPrec [VirtualServiceRef]
ReadPrec VirtualServiceRef
Int -> ReadS VirtualServiceRef
ReadS [VirtualServiceRef]
(Int -> ReadS VirtualServiceRef)
-> ReadS [VirtualServiceRef]
-> ReadPrec VirtualServiceRef
-> ReadPrec [VirtualServiceRef]
-> Read VirtualServiceRef
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VirtualServiceRef]
$creadListPrec :: ReadPrec [VirtualServiceRef]
readPrec :: ReadPrec VirtualServiceRef
$creadPrec :: ReadPrec VirtualServiceRef
readList :: ReadS [VirtualServiceRef]
$creadList :: ReadS [VirtualServiceRef]
readsPrec :: Int -> ReadS VirtualServiceRef
$creadsPrec :: Int -> ReadS VirtualServiceRef
Prelude.Read, Int -> VirtualServiceRef -> ShowS
[VirtualServiceRef] -> ShowS
VirtualServiceRef -> String
(Int -> VirtualServiceRef -> ShowS)
-> (VirtualServiceRef -> String)
-> ([VirtualServiceRef] -> ShowS)
-> Show VirtualServiceRef
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VirtualServiceRef] -> ShowS
$cshowList :: [VirtualServiceRef] -> ShowS
show :: VirtualServiceRef -> String
$cshow :: VirtualServiceRef -> String
showsPrec :: Int -> VirtualServiceRef -> ShowS
$cshowsPrec :: Int -> VirtualServiceRef -> ShowS
Prelude.Show, (forall x. VirtualServiceRef -> Rep VirtualServiceRef x)
-> (forall x. Rep VirtualServiceRef x -> VirtualServiceRef)
-> Generic VirtualServiceRef
forall x. Rep VirtualServiceRef x -> VirtualServiceRef
forall x. VirtualServiceRef -> Rep VirtualServiceRef x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep VirtualServiceRef x -> VirtualServiceRef
$cfrom :: forall x. VirtualServiceRef -> Rep VirtualServiceRef x
Prelude.Generic)

-- |
-- Create a value of 'VirtualServiceRef' 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:
--
-- 'arn', 'virtualServiceRef_arn' - The full Amazon Resource Name (ARN) for the virtual service.
--
-- 'createdAt', 'virtualServiceRef_createdAt' - The Unix epoch timestamp in seconds for when the resource was created.
--
-- 'lastUpdatedAt', 'virtualServiceRef_lastUpdatedAt' - The Unix epoch timestamp in seconds for when the resource was last
-- updated.
--
-- 'meshName', 'virtualServiceRef_meshName' - The name of the service mesh that the virtual service resides in.
--
-- 'meshOwner', 'virtualServiceRef_meshOwner' - The AWS IAM account ID of the service mesh owner. If the account ID is
-- not your own, then it\'s the ID of the account that shared the mesh with
-- your account. For more information about mesh sharing, see
-- <https://docs.aws.amazon.com/app-mesh/latest/userguide/sharing.html Working with shared meshes>.
--
-- 'resourceOwner', 'virtualServiceRef_resourceOwner' - The AWS IAM account ID of the resource owner. If the account ID is not
-- your own, then it\'s the ID of the mesh owner or of another account that
-- the mesh is shared with. For more information about mesh sharing, see
-- <https://docs.aws.amazon.com/app-mesh/latest/userguide/sharing.html Working with shared meshes>.
--
-- 'version', 'virtualServiceRef_version' - The version of the resource. Resources are created at version 1, and
-- this version is incremented each time that they\'re updated.
--
-- 'virtualServiceName', 'virtualServiceRef_virtualServiceName' - The name of the virtual service.
newVirtualServiceRef ::
  -- | 'arn'
  Prelude.Text ->
  -- | 'createdAt'
  Prelude.UTCTime ->
  -- | 'lastUpdatedAt'
  Prelude.UTCTime ->
  -- | 'meshName'
  Prelude.Text ->
  -- | 'meshOwner'
  Prelude.Text ->
  -- | 'resourceOwner'
  Prelude.Text ->
  -- | 'version'
  Prelude.Integer ->
  -- | 'virtualServiceName'
  Prelude.Text ->
  VirtualServiceRef
newVirtualServiceRef :: Text
-> UTCTime
-> UTCTime
-> Text
-> Text
-> Text
-> Integer
-> Text
-> VirtualServiceRef
newVirtualServiceRef
  Text
pArn_
  UTCTime
pCreatedAt_
  UTCTime
pLastUpdatedAt_
  Text
pMeshName_
  Text
pMeshOwner_
  Text
pResourceOwner_
  Integer
pVersion_
  Text
pVirtualServiceName_ =
    VirtualServiceRef' :: Text
-> POSIX
-> POSIX
-> Text
-> Text
-> Text
-> Integer
-> Text
-> VirtualServiceRef
VirtualServiceRef'
      { $sel:arn:VirtualServiceRef' :: Text
arn = Text
pArn_,
        $sel:createdAt:VirtualServiceRef' :: POSIX
createdAt = Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pCreatedAt_,
        $sel:lastUpdatedAt:VirtualServiceRef' :: POSIX
lastUpdatedAt = Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pLastUpdatedAt_,
        $sel:meshName:VirtualServiceRef' :: Text
meshName = Text
pMeshName_,
        $sel:meshOwner:VirtualServiceRef' :: Text
meshOwner = Text
pMeshOwner_,
        $sel:resourceOwner:VirtualServiceRef' :: Text
resourceOwner = Text
pResourceOwner_,
        $sel:version:VirtualServiceRef' :: Integer
version = Integer
pVersion_,
        $sel:virtualServiceName:VirtualServiceRef' :: Text
virtualServiceName = Text
pVirtualServiceName_
      }

-- | The full Amazon Resource Name (ARN) for the virtual service.
virtualServiceRef_arn :: Lens.Lens' VirtualServiceRef Prelude.Text
virtualServiceRef_arn :: (Text -> f Text) -> VirtualServiceRef -> f VirtualServiceRef
virtualServiceRef_arn = (VirtualServiceRef -> Text)
-> (VirtualServiceRef -> Text -> VirtualServiceRef)
-> Lens VirtualServiceRef VirtualServiceRef Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VirtualServiceRef' {Text
arn :: Text
$sel:arn:VirtualServiceRef' :: VirtualServiceRef -> Text
arn} -> Text
arn) (\s :: VirtualServiceRef
s@VirtualServiceRef' {} Text
a -> VirtualServiceRef
s {$sel:arn:VirtualServiceRef' :: Text
arn = Text
a} :: VirtualServiceRef)

-- | The Unix epoch timestamp in seconds for when the resource was created.
virtualServiceRef_createdAt :: Lens.Lens' VirtualServiceRef Prelude.UTCTime
virtualServiceRef_createdAt :: (UTCTime -> f UTCTime) -> VirtualServiceRef -> f VirtualServiceRef
virtualServiceRef_createdAt = (VirtualServiceRef -> POSIX)
-> (VirtualServiceRef -> POSIX -> VirtualServiceRef)
-> Lens VirtualServiceRef VirtualServiceRef POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VirtualServiceRef' {POSIX
createdAt :: POSIX
$sel:createdAt:VirtualServiceRef' :: VirtualServiceRef -> POSIX
createdAt} -> POSIX
createdAt) (\s :: VirtualServiceRef
s@VirtualServiceRef' {} POSIX
a -> VirtualServiceRef
s {$sel:createdAt:VirtualServiceRef' :: POSIX
createdAt = POSIX
a} :: VirtualServiceRef) ((POSIX -> f POSIX) -> VirtualServiceRef -> f VirtualServiceRef)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> VirtualServiceRef
-> f VirtualServiceRef
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The Unix epoch timestamp in seconds for when the resource was last
-- updated.
virtualServiceRef_lastUpdatedAt :: Lens.Lens' VirtualServiceRef Prelude.UTCTime
virtualServiceRef_lastUpdatedAt :: (UTCTime -> f UTCTime) -> VirtualServiceRef -> f VirtualServiceRef
virtualServiceRef_lastUpdatedAt = (VirtualServiceRef -> POSIX)
-> (VirtualServiceRef -> POSIX -> VirtualServiceRef)
-> Lens VirtualServiceRef VirtualServiceRef POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VirtualServiceRef' {POSIX
lastUpdatedAt :: POSIX
$sel:lastUpdatedAt:VirtualServiceRef' :: VirtualServiceRef -> POSIX
lastUpdatedAt} -> POSIX
lastUpdatedAt) (\s :: VirtualServiceRef
s@VirtualServiceRef' {} POSIX
a -> VirtualServiceRef
s {$sel:lastUpdatedAt:VirtualServiceRef' :: POSIX
lastUpdatedAt = POSIX
a} :: VirtualServiceRef) ((POSIX -> f POSIX) -> VirtualServiceRef -> f VirtualServiceRef)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> VirtualServiceRef
-> f VirtualServiceRef
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The name of the service mesh that the virtual service resides in.
virtualServiceRef_meshName :: Lens.Lens' VirtualServiceRef Prelude.Text
virtualServiceRef_meshName :: (Text -> f Text) -> VirtualServiceRef -> f VirtualServiceRef
virtualServiceRef_meshName = (VirtualServiceRef -> Text)
-> (VirtualServiceRef -> Text -> VirtualServiceRef)
-> Lens VirtualServiceRef VirtualServiceRef Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VirtualServiceRef' {Text
meshName :: Text
$sel:meshName:VirtualServiceRef' :: VirtualServiceRef -> Text
meshName} -> Text
meshName) (\s :: VirtualServiceRef
s@VirtualServiceRef' {} Text
a -> VirtualServiceRef
s {$sel:meshName:VirtualServiceRef' :: Text
meshName = Text
a} :: VirtualServiceRef)

-- | The AWS IAM account ID of the service mesh owner. If the account ID is
-- not your own, then it\'s the ID of the account that shared the mesh with
-- your account. For more information about mesh sharing, see
-- <https://docs.aws.amazon.com/app-mesh/latest/userguide/sharing.html Working with shared meshes>.
virtualServiceRef_meshOwner :: Lens.Lens' VirtualServiceRef Prelude.Text
virtualServiceRef_meshOwner :: (Text -> f Text) -> VirtualServiceRef -> f VirtualServiceRef
virtualServiceRef_meshOwner = (VirtualServiceRef -> Text)
-> (VirtualServiceRef -> Text -> VirtualServiceRef)
-> Lens VirtualServiceRef VirtualServiceRef Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VirtualServiceRef' {Text
meshOwner :: Text
$sel:meshOwner:VirtualServiceRef' :: VirtualServiceRef -> Text
meshOwner} -> Text
meshOwner) (\s :: VirtualServiceRef
s@VirtualServiceRef' {} Text
a -> VirtualServiceRef
s {$sel:meshOwner:VirtualServiceRef' :: Text
meshOwner = Text
a} :: VirtualServiceRef)

-- | The AWS IAM account ID of the resource owner. If the account ID is not
-- your own, then it\'s the ID of the mesh owner or of another account that
-- the mesh is shared with. For more information about mesh sharing, see
-- <https://docs.aws.amazon.com/app-mesh/latest/userguide/sharing.html Working with shared meshes>.
virtualServiceRef_resourceOwner :: Lens.Lens' VirtualServiceRef Prelude.Text
virtualServiceRef_resourceOwner :: (Text -> f Text) -> VirtualServiceRef -> f VirtualServiceRef
virtualServiceRef_resourceOwner = (VirtualServiceRef -> Text)
-> (VirtualServiceRef -> Text -> VirtualServiceRef)
-> Lens VirtualServiceRef VirtualServiceRef Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VirtualServiceRef' {Text
resourceOwner :: Text
$sel:resourceOwner:VirtualServiceRef' :: VirtualServiceRef -> Text
resourceOwner} -> Text
resourceOwner) (\s :: VirtualServiceRef
s@VirtualServiceRef' {} Text
a -> VirtualServiceRef
s {$sel:resourceOwner:VirtualServiceRef' :: Text
resourceOwner = Text
a} :: VirtualServiceRef)

-- | The version of the resource. Resources are created at version 1, and
-- this version is incremented each time that they\'re updated.
virtualServiceRef_version :: Lens.Lens' VirtualServiceRef Prelude.Integer
virtualServiceRef_version :: (Integer -> f Integer) -> VirtualServiceRef -> f VirtualServiceRef
virtualServiceRef_version = (VirtualServiceRef -> Integer)
-> (VirtualServiceRef -> Integer -> VirtualServiceRef)
-> Lens VirtualServiceRef VirtualServiceRef Integer Integer
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VirtualServiceRef' {Integer
version :: Integer
$sel:version:VirtualServiceRef' :: VirtualServiceRef -> Integer
version} -> Integer
version) (\s :: VirtualServiceRef
s@VirtualServiceRef' {} Integer
a -> VirtualServiceRef
s {$sel:version:VirtualServiceRef' :: Integer
version = Integer
a} :: VirtualServiceRef)

-- | The name of the virtual service.
virtualServiceRef_virtualServiceName :: Lens.Lens' VirtualServiceRef Prelude.Text
virtualServiceRef_virtualServiceName :: (Text -> f Text) -> VirtualServiceRef -> f VirtualServiceRef
virtualServiceRef_virtualServiceName = (VirtualServiceRef -> Text)
-> (VirtualServiceRef -> Text -> VirtualServiceRef)
-> Lens VirtualServiceRef VirtualServiceRef Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VirtualServiceRef' {Text
virtualServiceName :: Text
$sel:virtualServiceName:VirtualServiceRef' :: VirtualServiceRef -> Text
virtualServiceName} -> Text
virtualServiceName) (\s :: VirtualServiceRef
s@VirtualServiceRef' {} Text
a -> VirtualServiceRef
s {$sel:virtualServiceName:VirtualServiceRef' :: Text
virtualServiceName = Text
a} :: VirtualServiceRef)

instance Core.FromJSON VirtualServiceRef where
  parseJSON :: Value -> Parser VirtualServiceRef
parseJSON =
    String
-> (Object -> Parser VirtualServiceRef)
-> Value
-> Parser VirtualServiceRef
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"VirtualServiceRef"
      ( \Object
x ->
          Text
-> POSIX
-> POSIX
-> Text
-> Text
-> Text
-> Integer
-> Text
-> VirtualServiceRef
VirtualServiceRef'
            (Text
 -> POSIX
 -> POSIX
 -> Text
 -> Text
 -> Text
 -> Integer
 -> Text
 -> VirtualServiceRef)
-> Parser Text
-> Parser
     (POSIX
      -> POSIX
      -> Text
      -> Text
      -> Text
      -> Integer
      -> Text
      -> VirtualServiceRef)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"arn")
            Parser
  (POSIX
   -> POSIX
   -> Text
   -> Text
   -> Text
   -> Integer
   -> Text
   -> VirtualServiceRef)
-> Parser POSIX
-> Parser
     (POSIX
      -> Text -> Text -> Text -> Integer -> Text -> VirtualServiceRef)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser POSIX
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"createdAt")
            Parser
  (POSIX
   -> Text -> Text -> Text -> Integer -> Text -> VirtualServiceRef)
-> Parser POSIX
-> Parser
     (Text -> Text -> Text -> Integer -> Text -> VirtualServiceRef)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser POSIX
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"lastUpdatedAt")
            Parser
  (Text -> Text -> Text -> Integer -> Text -> VirtualServiceRef)
-> Parser Text
-> Parser (Text -> Text -> Integer -> Text -> VirtualServiceRef)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"meshName")
            Parser (Text -> Text -> Integer -> Text -> VirtualServiceRef)
-> Parser Text
-> Parser (Text -> Integer -> Text -> VirtualServiceRef)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"meshOwner")
            Parser (Text -> Integer -> Text -> VirtualServiceRef)
-> Parser Text -> Parser (Integer -> Text -> VirtualServiceRef)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"resourceOwner")
            Parser (Integer -> Text -> VirtualServiceRef)
-> Parser Integer -> Parser (Text -> VirtualServiceRef)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Integer
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"version")
            Parser (Text -> VirtualServiceRef)
-> Parser Text -> Parser VirtualServiceRef
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"virtualServiceName")
      )

instance Prelude.Hashable VirtualServiceRef

instance Prelude.NFData VirtualServiceRef