{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.AppMesh.Types.VirtualServiceRef 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

-- | 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 :: Data.POSIX,
    -- | The Unix epoch timestamp in seconds for when the resource was last
    -- updated.
    VirtualServiceRef -> POSIX
lastUpdatedAt :: Data.POSIX,
    -- | The name of the service mesh that the virtual service resides in.
    VirtualServiceRef -> Text
meshName :: Prelude.Text,
    -- | The Amazon Web Services 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 Amazon Web Services 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
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]
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
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. 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 Amazon Web Services 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 Amazon Web Services 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'
      { $sel:arn:VirtualServiceRef' :: Text
arn = Text
pArn_,
        $sel:createdAt:VirtualServiceRef' :: POSIX
createdAt = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pCreatedAt_,
        $sel:lastUpdatedAt:VirtualServiceRef' :: POSIX
lastUpdatedAt = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time 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 :: Lens' VirtualServiceRef Text
virtualServiceRef_arn = 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 :: Lens' VirtualServiceRef UTCTime
virtualServiceRef_createdAt = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The Unix epoch timestamp in seconds for when the resource was last
-- updated.
virtualServiceRef_lastUpdatedAt :: Lens.Lens' VirtualServiceRef Prelude.UTCTime
virtualServiceRef_lastUpdatedAt :: Lens' VirtualServiceRef UTCTime
virtualServiceRef_lastUpdatedAt = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The name of the service mesh that the virtual service resides in.
virtualServiceRef_meshName :: Lens.Lens' VirtualServiceRef Prelude.Text
virtualServiceRef_meshName :: Lens' VirtualServiceRef Text
virtualServiceRef_meshName = 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 Amazon Web Services 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 :: Lens' VirtualServiceRef Text
virtualServiceRef_meshOwner = 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 Amazon Web Services 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 :: Lens' VirtualServiceRef Text
virtualServiceRef_resourceOwner = 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 :: Lens' VirtualServiceRef Integer
virtualServiceRef_version = 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 :: Lens' VirtualServiceRef Text
virtualServiceRef_virtualServiceName = 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 Data.FromJSON VirtualServiceRef where
  parseJSON :: Value -> Parser VirtualServiceRef
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"VirtualServiceRef"
      ( \Object
x ->
          Text
-> POSIX
-> POSIX
-> Text
-> Text
-> Text
-> Integer
-> Text
-> VirtualServiceRef
VirtualServiceRef'
            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
"arn")
            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
"createdAt")
            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
"lastUpdatedAt")
            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
"meshName")
            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
"meshOwner")
            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
"resourceOwner")
            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
"version")
            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
"virtualServiceName")
      )

instance Prelude.Hashable VirtualServiceRef where
  hashWithSalt :: Int -> VirtualServiceRef -> Int
hashWithSalt Int
_salt VirtualServiceRef' {Integer
Text
POSIX
virtualServiceName :: Text
version :: Integer
resourceOwner :: Text
meshOwner :: Text
meshName :: Text
lastUpdatedAt :: POSIX
createdAt :: POSIX
arn :: Text
$sel:virtualServiceName:VirtualServiceRef' :: VirtualServiceRef -> Text
$sel:version:VirtualServiceRef' :: VirtualServiceRef -> Integer
$sel:resourceOwner:VirtualServiceRef' :: VirtualServiceRef -> Text
$sel:meshOwner:VirtualServiceRef' :: VirtualServiceRef -> Text
$sel:meshName:VirtualServiceRef' :: VirtualServiceRef -> Text
$sel:lastUpdatedAt:VirtualServiceRef' :: VirtualServiceRef -> POSIX
$sel:createdAt:VirtualServiceRef' :: VirtualServiceRef -> POSIX
$sel:arn:VirtualServiceRef' :: VirtualServiceRef -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
arn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` POSIX
createdAt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` POSIX
lastUpdatedAt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
meshName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
meshOwner
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
resourceOwner
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Integer
version
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
virtualServiceName

instance Prelude.NFData VirtualServiceRef where
  rnf :: VirtualServiceRef -> ()
rnf VirtualServiceRef' {Integer
Text
POSIX
virtualServiceName :: Text
version :: Integer
resourceOwner :: Text
meshOwner :: Text
meshName :: Text
lastUpdatedAt :: POSIX
createdAt :: POSIX
arn :: Text
$sel:virtualServiceName:VirtualServiceRef' :: VirtualServiceRef -> Text
$sel:version:VirtualServiceRef' :: VirtualServiceRef -> Integer
$sel:resourceOwner:VirtualServiceRef' :: VirtualServiceRef -> Text
$sel:meshOwner:VirtualServiceRef' :: VirtualServiceRef -> Text
$sel:meshName:VirtualServiceRef' :: VirtualServiceRef -> Text
$sel:lastUpdatedAt:VirtualServiceRef' :: VirtualServiceRef -> POSIX
$sel:createdAt:VirtualServiceRef' :: VirtualServiceRef -> POSIX
$sel:arn:VirtualServiceRef' :: VirtualServiceRef -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf POSIX
createdAt
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf POSIX
lastUpdatedAt
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
meshName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
meshOwner
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
resourceOwner
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Integer
version
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
virtualServiceName