{-# 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.GroundStation.Types.SecurityDetails
-- 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.GroundStation.Types.SecurityDetails where

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

-- | Information about endpoints.
--
-- /See:/ 'newSecurityDetails' smart constructor.
data SecurityDetails = SecurityDetails'
  { -- | ARN to a role needed for connecting streams to your instances.
    SecurityDetails -> Text
roleArn :: Prelude.Text,
    -- | The security groups to attach to the elastic network interfaces.
    SecurityDetails -> [Text]
securityGroupIds :: [Prelude.Text],
    -- | A list of subnets where AWS Ground Station places elastic network
    -- interfaces to send streams to your instances.
    SecurityDetails -> [Text]
subnetIds :: [Prelude.Text]
  }
  deriving (SecurityDetails -> SecurityDetails -> Bool
(SecurityDetails -> SecurityDetails -> Bool)
-> (SecurityDetails -> SecurityDetails -> Bool)
-> Eq SecurityDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SecurityDetails -> SecurityDetails -> Bool
$c/= :: SecurityDetails -> SecurityDetails -> Bool
== :: SecurityDetails -> SecurityDetails -> Bool
$c== :: SecurityDetails -> SecurityDetails -> Bool
Prelude.Eq, ReadPrec [SecurityDetails]
ReadPrec SecurityDetails
Int -> ReadS SecurityDetails
ReadS [SecurityDetails]
(Int -> ReadS SecurityDetails)
-> ReadS [SecurityDetails]
-> ReadPrec SecurityDetails
-> ReadPrec [SecurityDetails]
-> Read SecurityDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SecurityDetails]
$creadListPrec :: ReadPrec [SecurityDetails]
readPrec :: ReadPrec SecurityDetails
$creadPrec :: ReadPrec SecurityDetails
readList :: ReadS [SecurityDetails]
$creadList :: ReadS [SecurityDetails]
readsPrec :: Int -> ReadS SecurityDetails
$creadsPrec :: Int -> ReadS SecurityDetails
Prelude.Read, Int -> SecurityDetails -> ShowS
[SecurityDetails] -> ShowS
SecurityDetails -> String
(Int -> SecurityDetails -> ShowS)
-> (SecurityDetails -> String)
-> ([SecurityDetails] -> ShowS)
-> Show SecurityDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SecurityDetails] -> ShowS
$cshowList :: [SecurityDetails] -> ShowS
show :: SecurityDetails -> String
$cshow :: SecurityDetails -> String
showsPrec :: Int -> SecurityDetails -> ShowS
$cshowsPrec :: Int -> SecurityDetails -> ShowS
Prelude.Show, (forall x. SecurityDetails -> Rep SecurityDetails x)
-> (forall x. Rep SecurityDetails x -> SecurityDetails)
-> Generic SecurityDetails
forall x. Rep SecurityDetails x -> SecurityDetails
forall x. SecurityDetails -> Rep SecurityDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SecurityDetails x -> SecurityDetails
$cfrom :: forall x. SecurityDetails -> Rep SecurityDetails x
Prelude.Generic)

-- |
-- Create a value of 'SecurityDetails' 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:
--
-- 'roleArn', 'securityDetails_roleArn' - ARN to a role needed for connecting streams to your instances.
--
-- 'securityGroupIds', 'securityDetails_securityGroupIds' - The security groups to attach to the elastic network interfaces.
--
-- 'subnetIds', 'securityDetails_subnetIds' - A list of subnets where AWS Ground Station places elastic network
-- interfaces to send streams to your instances.
newSecurityDetails ::
  -- | 'roleArn'
  Prelude.Text ->
  SecurityDetails
newSecurityDetails :: Text -> SecurityDetails
newSecurityDetails Text
pRoleArn_ =
  SecurityDetails' :: Text -> [Text] -> [Text] -> SecurityDetails
SecurityDetails'
    { $sel:roleArn:SecurityDetails' :: Text
roleArn = Text
pRoleArn_,
      $sel:securityGroupIds:SecurityDetails' :: [Text]
securityGroupIds = [Text]
forall a. Monoid a => a
Prelude.mempty,
      $sel:subnetIds:SecurityDetails' :: [Text]
subnetIds = [Text]
forall a. Monoid a => a
Prelude.mempty
    }

-- | ARN to a role needed for connecting streams to your instances.
securityDetails_roleArn :: Lens.Lens' SecurityDetails Prelude.Text
securityDetails_roleArn :: (Text -> f Text) -> SecurityDetails -> f SecurityDetails
securityDetails_roleArn = (SecurityDetails -> Text)
-> (SecurityDetails -> Text -> SecurityDetails)
-> Lens SecurityDetails SecurityDetails Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SecurityDetails' {Text
roleArn :: Text
$sel:roleArn:SecurityDetails' :: SecurityDetails -> Text
roleArn} -> Text
roleArn) (\s :: SecurityDetails
s@SecurityDetails' {} Text
a -> SecurityDetails
s {$sel:roleArn:SecurityDetails' :: Text
roleArn = Text
a} :: SecurityDetails)

-- | The security groups to attach to the elastic network interfaces.
securityDetails_securityGroupIds :: Lens.Lens' SecurityDetails [Prelude.Text]
securityDetails_securityGroupIds :: ([Text] -> f [Text]) -> SecurityDetails -> f SecurityDetails
securityDetails_securityGroupIds = (SecurityDetails -> [Text])
-> (SecurityDetails -> [Text] -> SecurityDetails)
-> Lens SecurityDetails SecurityDetails [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SecurityDetails' {[Text]
securityGroupIds :: [Text]
$sel:securityGroupIds:SecurityDetails' :: SecurityDetails -> [Text]
securityGroupIds} -> [Text]
securityGroupIds) (\s :: SecurityDetails
s@SecurityDetails' {} [Text]
a -> SecurityDetails
s {$sel:securityGroupIds:SecurityDetails' :: [Text]
securityGroupIds = [Text]
a} :: SecurityDetails) (([Text] -> f [Text]) -> SecurityDetails -> f SecurityDetails)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> SecurityDetails
-> f SecurityDetails
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A list of subnets where AWS Ground Station places elastic network
-- interfaces to send streams to your instances.
securityDetails_subnetIds :: Lens.Lens' SecurityDetails [Prelude.Text]
securityDetails_subnetIds :: ([Text] -> f [Text]) -> SecurityDetails -> f SecurityDetails
securityDetails_subnetIds = (SecurityDetails -> [Text])
-> (SecurityDetails -> [Text] -> SecurityDetails)
-> Lens SecurityDetails SecurityDetails [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SecurityDetails' {[Text]
subnetIds :: [Text]
$sel:subnetIds:SecurityDetails' :: SecurityDetails -> [Text]
subnetIds} -> [Text]
subnetIds) (\s :: SecurityDetails
s@SecurityDetails' {} [Text]
a -> SecurityDetails
s {$sel:subnetIds:SecurityDetails' :: [Text]
subnetIds = [Text]
a} :: SecurityDetails) (([Text] -> f [Text]) -> SecurityDetails -> f SecurityDetails)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> SecurityDetails
-> f SecurityDetails
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON SecurityDetails where
  parseJSON :: Value -> Parser SecurityDetails
parseJSON =
    String
-> (Object -> Parser SecurityDetails)
-> Value
-> Parser SecurityDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SecurityDetails"
      ( \Object
x ->
          Text -> [Text] -> [Text] -> SecurityDetails
SecurityDetails'
            (Text -> [Text] -> [Text] -> SecurityDetails)
-> Parser Text -> Parser ([Text] -> [Text] -> SecurityDetails)
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
"roleArn")
            Parser ([Text] -> [Text] -> SecurityDetails)
-> Parser [Text] -> Parser ([Text] -> SecurityDetails)
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
"securityGroupIds"
                            Parser (Maybe [Text]) -> [Text] -> Parser [Text]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [Text]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser ([Text] -> SecurityDetails)
-> Parser [Text] -> Parser SecurityDetails
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
"subnetIds" Parser (Maybe [Text]) -> [Text] -> Parser [Text]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [Text]
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable SecurityDetails

instance Prelude.NFData SecurityDetails

instance Core.ToJSON SecurityDetails where
  toJSON :: SecurityDetails -> Value
toJSON SecurityDetails' {[Text]
Text
subnetIds :: [Text]
securityGroupIds :: [Text]
roleArn :: Text
$sel:subnetIds:SecurityDetails' :: SecurityDetails -> [Text]
$sel:securityGroupIds:SecurityDetails' :: SecurityDetails -> [Text]
$sel:roleArn:SecurityDetails' :: SecurityDetails -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"roleArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
roleArn),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"securityGroupIds" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Text]
securityGroupIds),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"subnetIds" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Text]
subnetIds)
          ]
      )