{-# 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.SageMaker.Types.WorkforceVpcConfigRequest
-- 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.SageMaker.Types.WorkforceVpcConfigRequest 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

-- | The VPC object you use to create or update a workforce.
--
-- /See:/ 'newWorkforceVpcConfigRequest' smart constructor.
data WorkforceVpcConfigRequest = WorkforceVpcConfigRequest'
  { -- | The VPC security group IDs, in the form sg-xxxxxxxx. The security groups
    -- must be for the same VPC as specified in the subnet.
    WorkforceVpcConfigRequest -> Maybe (NonEmpty Text)
securityGroupIds :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
    -- | The ID of the subnets in the VPC that you want to connect.
    WorkforceVpcConfigRequest -> Maybe (NonEmpty Text)
subnets :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
    -- | The ID of the VPC that the workforce uses for communication.
    WorkforceVpcConfigRequest -> Maybe Text
vpcId :: Prelude.Maybe Prelude.Text
  }
  deriving (WorkforceVpcConfigRequest -> WorkforceVpcConfigRequest -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WorkforceVpcConfigRequest -> WorkforceVpcConfigRequest -> Bool
$c/= :: WorkforceVpcConfigRequest -> WorkforceVpcConfigRequest -> Bool
== :: WorkforceVpcConfigRequest -> WorkforceVpcConfigRequest -> Bool
$c== :: WorkforceVpcConfigRequest -> WorkforceVpcConfigRequest -> Bool
Prelude.Eq, ReadPrec [WorkforceVpcConfigRequest]
ReadPrec WorkforceVpcConfigRequest
Int -> ReadS WorkforceVpcConfigRequest
ReadS [WorkforceVpcConfigRequest]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WorkforceVpcConfigRequest]
$creadListPrec :: ReadPrec [WorkforceVpcConfigRequest]
readPrec :: ReadPrec WorkforceVpcConfigRequest
$creadPrec :: ReadPrec WorkforceVpcConfigRequest
readList :: ReadS [WorkforceVpcConfigRequest]
$creadList :: ReadS [WorkforceVpcConfigRequest]
readsPrec :: Int -> ReadS WorkforceVpcConfigRequest
$creadsPrec :: Int -> ReadS WorkforceVpcConfigRequest
Prelude.Read, Int -> WorkforceVpcConfigRequest -> ShowS
[WorkforceVpcConfigRequest] -> ShowS
WorkforceVpcConfigRequest -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WorkforceVpcConfigRequest] -> ShowS
$cshowList :: [WorkforceVpcConfigRequest] -> ShowS
show :: WorkforceVpcConfigRequest -> String
$cshow :: WorkforceVpcConfigRequest -> String
showsPrec :: Int -> WorkforceVpcConfigRequest -> ShowS
$cshowsPrec :: Int -> WorkforceVpcConfigRequest -> ShowS
Prelude.Show, forall x.
Rep WorkforceVpcConfigRequest x -> WorkforceVpcConfigRequest
forall x.
WorkforceVpcConfigRequest -> Rep WorkforceVpcConfigRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep WorkforceVpcConfigRequest x -> WorkforceVpcConfigRequest
$cfrom :: forall x.
WorkforceVpcConfigRequest -> Rep WorkforceVpcConfigRequest x
Prelude.Generic)

-- |
-- Create a value of 'WorkforceVpcConfigRequest' 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:
--
-- 'securityGroupIds', 'workforceVpcConfigRequest_securityGroupIds' - The VPC security group IDs, in the form sg-xxxxxxxx. The security groups
-- must be for the same VPC as specified in the subnet.
--
-- 'subnets', 'workforceVpcConfigRequest_subnets' - The ID of the subnets in the VPC that you want to connect.
--
-- 'vpcId', 'workforceVpcConfigRequest_vpcId' - The ID of the VPC that the workforce uses for communication.
newWorkforceVpcConfigRequest ::
  WorkforceVpcConfigRequest
newWorkforceVpcConfigRequest :: WorkforceVpcConfigRequest
newWorkforceVpcConfigRequest =
  WorkforceVpcConfigRequest'
    { $sel:securityGroupIds:WorkforceVpcConfigRequest' :: Maybe (NonEmpty Text)
securityGroupIds =
        forall a. Maybe a
Prelude.Nothing,
      $sel:subnets:WorkforceVpcConfigRequest' :: Maybe (NonEmpty Text)
subnets = forall a. Maybe a
Prelude.Nothing,
      $sel:vpcId:WorkforceVpcConfigRequest' :: Maybe Text
vpcId = forall a. Maybe a
Prelude.Nothing
    }

-- | The VPC security group IDs, in the form sg-xxxxxxxx. The security groups
-- must be for the same VPC as specified in the subnet.
workforceVpcConfigRequest_securityGroupIds :: Lens.Lens' WorkforceVpcConfigRequest (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
workforceVpcConfigRequest_securityGroupIds :: Lens' WorkforceVpcConfigRequest (Maybe (NonEmpty Text))
workforceVpcConfigRequest_securityGroupIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkforceVpcConfigRequest' {Maybe (NonEmpty Text)
securityGroupIds :: Maybe (NonEmpty Text)
$sel:securityGroupIds:WorkforceVpcConfigRequest' :: WorkforceVpcConfigRequest -> Maybe (NonEmpty Text)
securityGroupIds} -> Maybe (NonEmpty Text)
securityGroupIds) (\s :: WorkforceVpcConfigRequest
s@WorkforceVpcConfigRequest' {} Maybe (NonEmpty Text)
a -> WorkforceVpcConfigRequest
s {$sel:securityGroupIds:WorkforceVpcConfigRequest' :: Maybe (NonEmpty Text)
securityGroupIds = Maybe (NonEmpty Text)
a} :: WorkforceVpcConfigRequest) 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 ID of the subnets in the VPC that you want to connect.
workforceVpcConfigRequest_subnets :: Lens.Lens' WorkforceVpcConfigRequest (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
workforceVpcConfigRequest_subnets :: Lens' WorkforceVpcConfigRequest (Maybe (NonEmpty Text))
workforceVpcConfigRequest_subnets = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkforceVpcConfigRequest' {Maybe (NonEmpty Text)
subnets :: Maybe (NonEmpty Text)
$sel:subnets:WorkforceVpcConfigRequest' :: WorkforceVpcConfigRequest -> Maybe (NonEmpty Text)
subnets} -> Maybe (NonEmpty Text)
subnets) (\s :: WorkforceVpcConfigRequest
s@WorkforceVpcConfigRequest' {} Maybe (NonEmpty Text)
a -> WorkforceVpcConfigRequest
s {$sel:subnets:WorkforceVpcConfigRequest' :: Maybe (NonEmpty Text)
subnets = Maybe (NonEmpty Text)
a} :: WorkforceVpcConfigRequest) 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 ID of the VPC that the workforce uses for communication.
workforceVpcConfigRequest_vpcId :: Lens.Lens' WorkforceVpcConfigRequest (Prelude.Maybe Prelude.Text)
workforceVpcConfigRequest_vpcId :: Lens' WorkforceVpcConfigRequest (Maybe Text)
workforceVpcConfigRequest_vpcId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkforceVpcConfigRequest' {Maybe Text
vpcId :: Maybe Text
$sel:vpcId:WorkforceVpcConfigRequest' :: WorkforceVpcConfigRequest -> Maybe Text
vpcId} -> Maybe Text
vpcId) (\s :: WorkforceVpcConfigRequest
s@WorkforceVpcConfigRequest' {} Maybe Text
a -> WorkforceVpcConfigRequest
s {$sel:vpcId:WorkforceVpcConfigRequest' :: Maybe Text
vpcId = Maybe Text
a} :: WorkforceVpcConfigRequest)

instance Prelude.Hashable WorkforceVpcConfigRequest where
  hashWithSalt :: Int -> WorkforceVpcConfigRequest -> Int
hashWithSalt Int
_salt WorkforceVpcConfigRequest' {Maybe (NonEmpty Text)
Maybe Text
vpcId :: Maybe Text
subnets :: Maybe (NonEmpty Text)
securityGroupIds :: Maybe (NonEmpty Text)
$sel:vpcId:WorkforceVpcConfigRequest' :: WorkforceVpcConfigRequest -> Maybe Text
$sel:subnets:WorkforceVpcConfigRequest' :: WorkforceVpcConfigRequest -> Maybe (NonEmpty Text)
$sel:securityGroupIds:WorkforceVpcConfigRequest' :: WorkforceVpcConfigRequest -> Maybe (NonEmpty Text)
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty Text)
securityGroupIds
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty Text)
subnets
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
vpcId

instance Prelude.NFData WorkforceVpcConfigRequest where
  rnf :: WorkforceVpcConfigRequest -> ()
rnf WorkforceVpcConfigRequest' {Maybe (NonEmpty Text)
Maybe Text
vpcId :: Maybe Text
subnets :: Maybe (NonEmpty Text)
securityGroupIds :: Maybe (NonEmpty Text)
$sel:vpcId:WorkforceVpcConfigRequest' :: WorkforceVpcConfigRequest -> Maybe Text
$sel:subnets:WorkforceVpcConfigRequest' :: WorkforceVpcConfigRequest -> Maybe (NonEmpty Text)
$sel:securityGroupIds:WorkforceVpcConfigRequest' :: WorkforceVpcConfigRequest -> Maybe (NonEmpty Text)
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty Text)
securityGroupIds
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty Text)
subnets
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
vpcId

instance Data.ToJSON WorkforceVpcConfigRequest where
  toJSON :: WorkforceVpcConfigRequest -> Value
toJSON WorkforceVpcConfigRequest' {Maybe (NonEmpty Text)
Maybe Text
vpcId :: Maybe Text
subnets :: Maybe (NonEmpty Text)
securityGroupIds :: Maybe (NonEmpty Text)
$sel:vpcId:WorkforceVpcConfigRequest' :: WorkforceVpcConfigRequest -> Maybe Text
$sel:subnets:WorkforceVpcConfigRequest' :: WorkforceVpcConfigRequest -> Maybe (NonEmpty Text)
$sel:securityGroupIds:WorkforceVpcConfigRequest' :: WorkforceVpcConfigRequest -> Maybe (NonEmpty Text)
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"SecurityGroupIds" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Text)
securityGroupIds,
            (Key
"Subnets" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Text)
subnets,
            (Key
"VpcId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
vpcId
          ]
      )