{-# 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.CodeStarConnections.Types.Host
-- 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.CodeStarConnections.Types.Host where

import Amazonka.CodeStarConnections.Types.ProviderType
import Amazonka.CodeStarConnections.Types.VpcConfiguration
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | A resource that represents the infrastructure where a third-party
-- provider is installed. The host is used when you create connections to
-- an installed third-party provider type, such as GitHub Enterprise
-- Server. You create one host for all connections to that provider.
--
-- A host created through the CLI or the SDK is in \`PENDING\` status by
-- default. You can make its status \`AVAILABLE\` by setting up the host in
-- the console.
--
-- /See:/ 'newHost' smart constructor.
data Host = Host'
  { -- | The status of the host, such as PENDING, AVAILABLE, VPC_CONFIG_DELETING,
    -- VPC_CONFIG_INITIALIZING, and VPC_CONFIG_FAILED_INITIALIZATION.
    Host -> Maybe Text
status :: Prelude.Maybe Prelude.Text,
    -- | The endpoint of the infrastructure where your provider type is
    -- installed.
    Host -> Maybe Text
providerEndpoint :: Prelude.Maybe Prelude.Text,
    -- | The name of the installed provider to be associated with your
    -- connection. The host resource represents the infrastructure where your
    -- provider type is installed. The valid provider type is GitHub Enterprise
    -- Server.
    Host -> Maybe ProviderType
providerType :: Prelude.Maybe ProviderType,
    -- | The status description for the host.
    Host -> Maybe Text
statusMessage :: Prelude.Maybe Prelude.Text,
    -- | The name of the host.
    Host -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the host.
    Host -> Maybe Text
hostArn :: Prelude.Maybe Prelude.Text,
    -- | The VPC configuration provisioned for the host.
    Host -> Maybe VpcConfiguration
vpcConfiguration :: Prelude.Maybe VpcConfiguration
  }
  deriving (Host -> Host -> Bool
(Host -> Host -> Bool) -> (Host -> Host -> Bool) -> Eq Host
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Host -> Host -> Bool
$c/= :: Host -> Host -> Bool
== :: Host -> Host -> Bool
$c== :: Host -> Host -> Bool
Prelude.Eq, ReadPrec [Host]
ReadPrec Host
Int -> ReadS Host
ReadS [Host]
(Int -> ReadS Host)
-> ReadS [Host] -> ReadPrec Host -> ReadPrec [Host] -> Read Host
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Host]
$creadListPrec :: ReadPrec [Host]
readPrec :: ReadPrec Host
$creadPrec :: ReadPrec Host
readList :: ReadS [Host]
$creadList :: ReadS [Host]
readsPrec :: Int -> ReadS Host
$creadsPrec :: Int -> ReadS Host
Prelude.Read, Int -> Host -> ShowS
[Host] -> ShowS
Host -> String
(Int -> Host -> ShowS)
-> (Host -> String) -> ([Host] -> ShowS) -> Show Host
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Host] -> ShowS
$cshowList :: [Host] -> ShowS
show :: Host -> String
$cshow :: Host -> String
showsPrec :: Int -> Host -> ShowS
$cshowsPrec :: Int -> Host -> ShowS
Prelude.Show, (forall x. Host -> Rep Host x)
-> (forall x. Rep Host x -> Host) -> Generic Host
forall x. Rep Host x -> Host
forall x. Host -> Rep Host x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Host x -> Host
$cfrom :: forall x. Host -> Rep Host x
Prelude.Generic)

-- |
-- Create a value of 'Host' 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:
--
-- 'status', 'host_status' - The status of the host, such as PENDING, AVAILABLE, VPC_CONFIG_DELETING,
-- VPC_CONFIG_INITIALIZING, and VPC_CONFIG_FAILED_INITIALIZATION.
--
-- 'providerEndpoint', 'host_providerEndpoint' - The endpoint of the infrastructure where your provider type is
-- installed.
--
-- 'providerType', 'host_providerType' - The name of the installed provider to be associated with your
-- connection. The host resource represents the infrastructure where your
-- provider type is installed. The valid provider type is GitHub Enterprise
-- Server.
--
-- 'statusMessage', 'host_statusMessage' - The status description for the host.
--
-- 'name', 'host_name' - The name of the host.
--
-- 'hostArn', 'host_hostArn' - The Amazon Resource Name (ARN) of the host.
--
-- 'vpcConfiguration', 'host_vpcConfiguration' - The VPC configuration provisioned for the host.
newHost ::
  Host
newHost :: Host
newHost =
  Host' :: Maybe Text
-> Maybe Text
-> Maybe ProviderType
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe VpcConfiguration
-> Host
Host'
    { $sel:status:Host' :: Maybe Text
status = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:providerEndpoint:Host' :: Maybe Text
providerEndpoint = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:providerType:Host' :: Maybe ProviderType
providerType = Maybe ProviderType
forall a. Maybe a
Prelude.Nothing,
      $sel:statusMessage:Host' :: Maybe Text
statusMessage = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:Host' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:hostArn:Host' :: Maybe Text
hostArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:vpcConfiguration:Host' :: Maybe VpcConfiguration
vpcConfiguration = Maybe VpcConfiguration
forall a. Maybe a
Prelude.Nothing
    }

-- | The status of the host, such as PENDING, AVAILABLE, VPC_CONFIG_DELETING,
-- VPC_CONFIG_INITIALIZING, and VPC_CONFIG_FAILED_INITIALIZATION.
host_status :: Lens.Lens' Host (Prelude.Maybe Prelude.Text)
host_status :: (Maybe Text -> f (Maybe Text)) -> Host -> f Host
host_status = (Host -> Maybe Text)
-> (Host -> Maybe Text -> Host)
-> Lens Host Host (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Host' {Maybe Text
status :: Maybe Text
$sel:status:Host' :: Host -> Maybe Text
status} -> Maybe Text
status) (\s :: Host
s@Host' {} Maybe Text
a -> Host
s {$sel:status:Host' :: Maybe Text
status = Maybe Text
a} :: Host)

-- | The endpoint of the infrastructure where your provider type is
-- installed.
host_providerEndpoint :: Lens.Lens' Host (Prelude.Maybe Prelude.Text)
host_providerEndpoint :: (Maybe Text -> f (Maybe Text)) -> Host -> f Host
host_providerEndpoint = (Host -> Maybe Text)
-> (Host -> Maybe Text -> Host)
-> Lens Host Host (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Host' {Maybe Text
providerEndpoint :: Maybe Text
$sel:providerEndpoint:Host' :: Host -> Maybe Text
providerEndpoint} -> Maybe Text
providerEndpoint) (\s :: Host
s@Host' {} Maybe Text
a -> Host
s {$sel:providerEndpoint:Host' :: Maybe Text
providerEndpoint = Maybe Text
a} :: Host)

-- | The name of the installed provider to be associated with your
-- connection. The host resource represents the infrastructure where your
-- provider type is installed. The valid provider type is GitHub Enterprise
-- Server.
host_providerType :: Lens.Lens' Host (Prelude.Maybe ProviderType)
host_providerType :: (Maybe ProviderType -> f (Maybe ProviderType)) -> Host -> f Host
host_providerType = (Host -> Maybe ProviderType)
-> (Host -> Maybe ProviderType -> Host)
-> Lens Host Host (Maybe ProviderType) (Maybe ProviderType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Host' {Maybe ProviderType
providerType :: Maybe ProviderType
$sel:providerType:Host' :: Host -> Maybe ProviderType
providerType} -> Maybe ProviderType
providerType) (\s :: Host
s@Host' {} Maybe ProviderType
a -> Host
s {$sel:providerType:Host' :: Maybe ProviderType
providerType = Maybe ProviderType
a} :: Host)

-- | The status description for the host.
host_statusMessage :: Lens.Lens' Host (Prelude.Maybe Prelude.Text)
host_statusMessage :: (Maybe Text -> f (Maybe Text)) -> Host -> f Host
host_statusMessage = (Host -> Maybe Text)
-> (Host -> Maybe Text -> Host)
-> Lens Host Host (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Host' {Maybe Text
statusMessage :: Maybe Text
$sel:statusMessage:Host' :: Host -> Maybe Text
statusMessage} -> Maybe Text
statusMessage) (\s :: Host
s@Host' {} Maybe Text
a -> Host
s {$sel:statusMessage:Host' :: Maybe Text
statusMessage = Maybe Text
a} :: Host)

-- | The name of the host.
host_name :: Lens.Lens' Host (Prelude.Maybe Prelude.Text)
host_name :: (Maybe Text -> f (Maybe Text)) -> Host -> f Host
host_name = (Host -> Maybe Text)
-> (Host -> Maybe Text -> Host)
-> Lens Host Host (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Host' {Maybe Text
name :: Maybe Text
$sel:name:Host' :: Host -> Maybe Text
name} -> Maybe Text
name) (\s :: Host
s@Host' {} Maybe Text
a -> Host
s {$sel:name:Host' :: Maybe Text
name = Maybe Text
a} :: Host)

-- | The Amazon Resource Name (ARN) of the host.
host_hostArn :: Lens.Lens' Host (Prelude.Maybe Prelude.Text)
host_hostArn :: (Maybe Text -> f (Maybe Text)) -> Host -> f Host
host_hostArn = (Host -> Maybe Text)
-> (Host -> Maybe Text -> Host)
-> Lens Host Host (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Host' {Maybe Text
hostArn :: Maybe Text
$sel:hostArn:Host' :: Host -> Maybe Text
hostArn} -> Maybe Text
hostArn) (\s :: Host
s@Host' {} Maybe Text
a -> Host
s {$sel:hostArn:Host' :: Maybe Text
hostArn = Maybe Text
a} :: Host)

-- | The VPC configuration provisioned for the host.
host_vpcConfiguration :: Lens.Lens' Host (Prelude.Maybe VpcConfiguration)
host_vpcConfiguration :: (Maybe VpcConfiguration -> f (Maybe VpcConfiguration))
-> Host -> f Host
host_vpcConfiguration = (Host -> Maybe VpcConfiguration)
-> (Host -> Maybe VpcConfiguration -> Host)
-> Lens Host Host (Maybe VpcConfiguration) (Maybe VpcConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Host' {Maybe VpcConfiguration
vpcConfiguration :: Maybe VpcConfiguration
$sel:vpcConfiguration:Host' :: Host -> Maybe VpcConfiguration
vpcConfiguration} -> Maybe VpcConfiguration
vpcConfiguration) (\s :: Host
s@Host' {} Maybe VpcConfiguration
a -> Host
s {$sel:vpcConfiguration:Host' :: Maybe VpcConfiguration
vpcConfiguration = Maybe VpcConfiguration
a} :: Host)

instance Core.FromJSON Host where
  parseJSON :: Value -> Parser Host
parseJSON =
    String -> (Object -> Parser Host) -> Value -> Parser Host
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Host"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe ProviderType
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe VpcConfiguration
-> Host
Host'
            (Maybe Text
 -> Maybe Text
 -> Maybe ProviderType
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe VpcConfiguration
 -> Host)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe ProviderType
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe VpcConfiguration
      -> Host)
forall (f :: * -> *) a b. Functor 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
"Status")
            Parser
  (Maybe Text
   -> Maybe ProviderType
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe VpcConfiguration
   -> Host)
-> Parser (Maybe Text)
-> Parser
     (Maybe ProviderType
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe VpcConfiguration
      -> Host)
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
"ProviderEndpoint")
            Parser
  (Maybe ProviderType
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe VpcConfiguration
   -> Host)
-> Parser (Maybe ProviderType)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe Text -> Maybe VpcConfiguration -> Host)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ProviderType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ProviderType")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe Text -> Maybe VpcConfiguration -> Host)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe Text -> Maybe VpcConfiguration -> Host)
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
"StatusMessage")
            Parser (Maybe Text -> Maybe Text -> Maybe VpcConfiguration -> Host)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe VpcConfiguration -> Host)
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
"Name")
            Parser (Maybe Text -> Maybe VpcConfiguration -> Host)
-> Parser (Maybe Text) -> Parser (Maybe VpcConfiguration -> Host)
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
"HostArn")
            Parser (Maybe VpcConfiguration -> Host)
-> Parser (Maybe VpcConfiguration) -> Parser Host
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe VpcConfiguration)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"VpcConfiguration")
      )

instance Prelude.Hashable Host

instance Prelude.NFData Host