{-# 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.ResourceExplorer2.Types.View
-- 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.ResourceExplorer2.Types.View 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
import Amazonka.ResourceExplorer2.Types.IncludedProperty
import Amazonka.ResourceExplorer2.Types.SearchFilter

-- | A view is a structure that defines a set of filters that provide a view
-- into the information in the Amazon Web Services Resource Explorer index.
-- The filters specify which information from the index is visible to the
-- users of the view. For example, you can specify filters that include
-- only resources that are tagged with the key \"ENV\" and the value
-- \"DEVELOPMENT\" in the results returned by this view. You could also
-- create a second view that includes only resources that are tagged with
-- \"ENV\" and \"PRODUCTION\".
--
-- /See:/ 'newView' smart constructor.
data View = View'
  { -- | An array of SearchFilter objects that specify which resources can be
    -- included in the results of queries made using this view.
    View -> Maybe (Sensitive SearchFilter)
filters :: Prelude.Maybe (Data.Sensitive SearchFilter),
    -- | A structure that contains additional information about the view.
    View -> Maybe [IncludedProperty]
includedProperties :: Prelude.Maybe [IncludedProperty],
    -- | The date and time when this view was last modified.
    View -> Maybe ISO8601
lastUpdatedAt :: Prelude.Maybe Data.ISO8601,
    -- | The Amazon Web Services account that owns this view.
    View -> Maybe Text
owner :: Prelude.Maybe Prelude.Text,
    -- | An
    -- <https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html Amazon resource name (ARN)>
    -- of an Amazon Web Services account, an organization, or an organizational
    -- unit (OU) that specifies whether this view includes resources from only
    -- the specified Amazon Web Services account, all accounts in the specified
    -- organization, or all accounts in the specified OU.
    --
    -- If not specified, the value defaults to the Amazon Web Services account
    -- used to call this operation.
    View -> Maybe Text
scope :: Prelude.Maybe Prelude.Text,
    -- | The
    -- <https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html Amazon resource name (ARN)>
    -- of the view.
    View -> Maybe Text
viewArn :: Prelude.Maybe Prelude.Text
  }
  deriving (View -> View -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: View -> View -> Bool
$c/= :: View -> View -> Bool
== :: View -> View -> Bool
$c== :: View -> View -> Bool
Prelude.Eq, Int -> View -> ShowS
[View] -> ShowS
View -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [View] -> ShowS
$cshowList :: [View] -> ShowS
show :: View -> String
$cshow :: View -> String
showsPrec :: Int -> View -> ShowS
$cshowsPrec :: Int -> View -> ShowS
Prelude.Show, forall x. Rep View x -> View
forall x. View -> Rep View x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep View x -> View
$cfrom :: forall x. View -> Rep View x
Prelude.Generic)

-- |
-- Create a value of 'View' 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:
--
-- 'filters', 'view_filters' - An array of SearchFilter objects that specify which resources can be
-- included in the results of queries made using this view.
--
-- 'includedProperties', 'view_includedProperties' - A structure that contains additional information about the view.
--
-- 'lastUpdatedAt', 'view_lastUpdatedAt' - The date and time when this view was last modified.
--
-- 'owner', 'view_owner' - The Amazon Web Services account that owns this view.
--
-- 'scope', 'view_scope' - An
-- <https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html Amazon resource name (ARN)>
-- of an Amazon Web Services account, an organization, or an organizational
-- unit (OU) that specifies whether this view includes resources from only
-- the specified Amazon Web Services account, all accounts in the specified
-- organization, or all accounts in the specified OU.
--
-- If not specified, the value defaults to the Amazon Web Services account
-- used to call this operation.
--
-- 'viewArn', 'view_viewArn' - The
-- <https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html Amazon resource name (ARN)>
-- of the view.
newView ::
  View
newView :: View
newView =
  View'
    { $sel:filters:View' :: Maybe (Sensitive SearchFilter)
filters = forall a. Maybe a
Prelude.Nothing,
      $sel:includedProperties:View' :: Maybe [IncludedProperty]
includedProperties = forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdatedAt:View' :: Maybe ISO8601
lastUpdatedAt = forall a. Maybe a
Prelude.Nothing,
      $sel:owner:View' :: Maybe Text
owner = forall a. Maybe a
Prelude.Nothing,
      $sel:scope:View' :: Maybe Text
scope = forall a. Maybe a
Prelude.Nothing,
      $sel:viewArn:View' :: Maybe Text
viewArn = forall a. Maybe a
Prelude.Nothing
    }

-- | An array of SearchFilter objects that specify which resources can be
-- included in the results of queries made using this view.
view_filters :: Lens.Lens' View (Prelude.Maybe SearchFilter)
view_filters :: Lens' View (Maybe SearchFilter)
view_filters = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\View' {Maybe (Sensitive SearchFilter)
filters :: Maybe (Sensitive SearchFilter)
$sel:filters:View' :: View -> Maybe (Sensitive SearchFilter)
filters} -> Maybe (Sensitive SearchFilter)
filters) (\s :: View
s@View' {} Maybe (Sensitive SearchFilter)
a -> View
s {$sel:filters:View' :: Maybe (Sensitive SearchFilter)
filters = Maybe (Sensitive SearchFilter)
a} :: View) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall a. Iso' (Sensitive a) a
Data._Sensitive

-- | A structure that contains additional information about the view.
view_includedProperties :: Lens.Lens' View (Prelude.Maybe [IncludedProperty])
view_includedProperties :: Lens' View (Maybe [IncludedProperty])
view_includedProperties = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\View' {Maybe [IncludedProperty]
includedProperties :: Maybe [IncludedProperty]
$sel:includedProperties:View' :: View -> Maybe [IncludedProperty]
includedProperties} -> Maybe [IncludedProperty]
includedProperties) (\s :: View
s@View' {} Maybe [IncludedProperty]
a -> View
s {$sel:includedProperties:View' :: Maybe [IncludedProperty]
includedProperties = Maybe [IncludedProperty]
a} :: View) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The date and time when this view was last modified.
view_lastUpdatedAt :: Lens.Lens' View (Prelude.Maybe Prelude.UTCTime)
view_lastUpdatedAt :: Lens' View (Maybe UTCTime)
view_lastUpdatedAt = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\View' {Maybe ISO8601
lastUpdatedAt :: Maybe ISO8601
$sel:lastUpdatedAt:View' :: View -> Maybe ISO8601
lastUpdatedAt} -> Maybe ISO8601
lastUpdatedAt) (\s :: View
s@View' {} Maybe ISO8601
a -> View
s {$sel:lastUpdatedAt:View' :: Maybe ISO8601
lastUpdatedAt = Maybe ISO8601
a} :: View) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The Amazon Web Services account that owns this view.
view_owner :: Lens.Lens' View (Prelude.Maybe Prelude.Text)
view_owner :: Lens' View (Maybe Text)
view_owner = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\View' {Maybe Text
owner :: Maybe Text
$sel:owner:View' :: View -> Maybe Text
owner} -> Maybe Text
owner) (\s :: View
s@View' {} Maybe Text
a -> View
s {$sel:owner:View' :: Maybe Text
owner = Maybe Text
a} :: View)

-- | An
-- <https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html Amazon resource name (ARN)>
-- of an Amazon Web Services account, an organization, or an organizational
-- unit (OU) that specifies whether this view includes resources from only
-- the specified Amazon Web Services account, all accounts in the specified
-- organization, or all accounts in the specified OU.
--
-- If not specified, the value defaults to the Amazon Web Services account
-- used to call this operation.
view_scope :: Lens.Lens' View (Prelude.Maybe Prelude.Text)
view_scope :: Lens' View (Maybe Text)
view_scope = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\View' {Maybe Text
scope :: Maybe Text
$sel:scope:View' :: View -> Maybe Text
scope} -> Maybe Text
scope) (\s :: View
s@View' {} Maybe Text
a -> View
s {$sel:scope:View' :: Maybe Text
scope = Maybe Text
a} :: View)

-- | The
-- <https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html Amazon resource name (ARN)>
-- of the view.
view_viewArn :: Lens.Lens' View (Prelude.Maybe Prelude.Text)
view_viewArn :: Lens' View (Maybe Text)
view_viewArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\View' {Maybe Text
viewArn :: Maybe Text
$sel:viewArn:View' :: View -> Maybe Text
viewArn} -> Maybe Text
viewArn) (\s :: View
s@View' {} Maybe Text
a -> View
s {$sel:viewArn:View' :: Maybe Text
viewArn = Maybe Text
a} :: View)

instance Data.FromJSON View where
  parseJSON :: Value -> Parser View
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"View"
      ( \Object
x ->
          Maybe (Sensitive SearchFilter)
-> Maybe [IncludedProperty]
-> Maybe ISO8601
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> View
View'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Filters")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"IncludedProperties"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe 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 (Maybe a)
Data..:? Key
"Owner")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Scope")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ViewArn")
      )

instance Prelude.Hashable View where
  hashWithSalt :: Int -> View -> Int
hashWithSalt Int
_salt View' {Maybe [IncludedProperty]
Maybe Text
Maybe (Sensitive SearchFilter)
Maybe ISO8601
viewArn :: Maybe Text
scope :: Maybe Text
owner :: Maybe Text
lastUpdatedAt :: Maybe ISO8601
includedProperties :: Maybe [IncludedProperty]
filters :: Maybe (Sensitive SearchFilter)
$sel:viewArn:View' :: View -> Maybe Text
$sel:scope:View' :: View -> Maybe Text
$sel:owner:View' :: View -> Maybe Text
$sel:lastUpdatedAt:View' :: View -> Maybe ISO8601
$sel:includedProperties:View' :: View -> Maybe [IncludedProperty]
$sel:filters:View' :: View -> Maybe (Sensitive SearchFilter)
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive SearchFilter)
filters
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [IncludedProperty]
includedProperties
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ISO8601
lastUpdatedAt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
owner
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
scope
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
viewArn

instance Prelude.NFData View where
  rnf :: View -> ()
rnf View' {Maybe [IncludedProperty]
Maybe Text
Maybe (Sensitive SearchFilter)
Maybe ISO8601
viewArn :: Maybe Text
scope :: Maybe Text
owner :: Maybe Text
lastUpdatedAt :: Maybe ISO8601
includedProperties :: Maybe [IncludedProperty]
filters :: Maybe (Sensitive SearchFilter)
$sel:viewArn:View' :: View -> Maybe Text
$sel:scope:View' :: View -> Maybe Text
$sel:owner:View' :: View -> Maybe Text
$sel:lastUpdatedAt:View' :: View -> Maybe ISO8601
$sel:includedProperties:View' :: View -> Maybe [IncludedProperty]
$sel:filters:View' :: View -> Maybe (Sensitive SearchFilter)
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive SearchFilter)
filters
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [IncludedProperty]
includedProperties
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ISO8601
lastUpdatedAt
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
owner
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
scope
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
viewArn