{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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 Amazon Resource Name (ARN) of the host.
    Host -> Maybe Text
hostArn :: Prelude.Maybe Prelude.Text,
    -- | The name of the host.
    Host -> Maybe Text
name :: 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 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 status description for the host.
    Host -> Maybe Text
statusMessage :: Prelude.Maybe Prelude.Text,
    -- | The VPC configuration provisioned for the host.
    Host -> Maybe VpcConfiguration
vpcConfiguration :: Prelude.Maybe VpcConfiguration
  }
  deriving (Host -> Host -> Bool
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]
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
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. 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:
--
-- 'hostArn', 'host_hostArn' - The Amazon Resource Name (ARN) of the host.
--
-- 'name', 'host_name' - The name of the host.
--
-- '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.
--
-- 'status', 'host_status' - The status of the host, such as PENDING, AVAILABLE, VPC_CONFIG_DELETING,
-- VPC_CONFIG_INITIALIZING, and VPC_CONFIG_FAILED_INITIALIZATION.
--
-- 'statusMessage', 'host_statusMessage' - The status description for the host.
--
-- 'vpcConfiguration', 'host_vpcConfiguration' - The VPC configuration provisioned for the host.
newHost ::
  Host
newHost :: Host
newHost =
  Host'
    { $sel:hostArn:Host' :: Maybe Text
hostArn = forall a. Maybe a
Prelude.Nothing,
      $sel:name:Host' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:providerEndpoint:Host' :: Maybe Text
providerEndpoint = forall a. Maybe a
Prelude.Nothing,
      $sel:providerType:Host' :: Maybe ProviderType
providerType = forall a. Maybe a
Prelude.Nothing,
      $sel:status:Host' :: Maybe Text
status = forall a. Maybe a
Prelude.Nothing,
      $sel:statusMessage:Host' :: Maybe Text
statusMessage = forall a. Maybe a
Prelude.Nothing,
      $sel:vpcConfiguration:Host' :: Maybe VpcConfiguration
vpcConfiguration = forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name (ARN) of the host.
host_hostArn :: Lens.Lens' Host (Prelude.Maybe Prelude.Text)
host_hostArn :: Lens' Host (Maybe Text)
host_hostArn = 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 name of the host.
host_name :: Lens.Lens' Host (Prelude.Maybe Prelude.Text)
host_name :: Lens' Host (Maybe Text)
host_name = 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 endpoint of the infrastructure where your provider type is
-- installed.
host_providerEndpoint :: Lens.Lens' Host (Prelude.Maybe Prelude.Text)
host_providerEndpoint :: Lens' Host (Maybe Text)
host_providerEndpoint = 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 :: Lens' Host (Maybe ProviderType)
host_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 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 :: Lens' Host (Maybe Text)
host_status = 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 status description for the host.
host_statusMessage :: Lens.Lens' Host (Prelude.Maybe Prelude.Text)
host_statusMessage :: Lens' Host (Maybe Text)
host_statusMessage = 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 VPC configuration provisioned for the host.
host_vpcConfiguration :: Lens.Lens' Host (Prelude.Maybe VpcConfiguration)
host_vpcConfiguration :: Lens' Host (Maybe VpcConfiguration)
host_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 Data.FromJSON Host where
  parseJSON :: Value -> Parser Host
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Host"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe ProviderType
-> Maybe Text
-> Maybe Text
-> Maybe VpcConfiguration
-> Host
Host'
            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
"HostArn")
            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
"Name")
            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
"ProviderEndpoint")
            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
"ProviderType")
            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
"Status")
            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
"StatusMessage")
            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
"VpcConfiguration")
      )

instance Prelude.Hashable Host where
  hashWithSalt :: Int -> Host -> Int
hashWithSalt Int
_salt Host' {Maybe Text
Maybe ProviderType
Maybe VpcConfiguration
vpcConfiguration :: Maybe VpcConfiguration
statusMessage :: Maybe Text
status :: Maybe Text
providerType :: Maybe ProviderType
providerEndpoint :: Maybe Text
name :: Maybe Text
hostArn :: Maybe Text
$sel:vpcConfiguration:Host' :: Host -> Maybe VpcConfiguration
$sel:statusMessage:Host' :: Host -> Maybe Text
$sel:status:Host' :: Host -> Maybe Text
$sel:providerType:Host' :: Host -> Maybe ProviderType
$sel:providerEndpoint:Host' :: Host -> Maybe Text
$sel:name:Host' :: Host -> Maybe Text
$sel:hostArn:Host' :: Host -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
hostArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
providerEndpoint
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ProviderType
providerType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
status
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
statusMessage
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe VpcConfiguration
vpcConfiguration

instance Prelude.NFData Host where
  rnf :: Host -> ()
rnf Host' {Maybe Text
Maybe ProviderType
Maybe VpcConfiguration
vpcConfiguration :: Maybe VpcConfiguration
statusMessage :: Maybe Text
status :: Maybe Text
providerType :: Maybe ProviderType
providerEndpoint :: Maybe Text
name :: Maybe Text
hostArn :: Maybe Text
$sel:vpcConfiguration:Host' :: Host -> Maybe VpcConfiguration
$sel:statusMessage:Host' :: Host -> Maybe Text
$sel:status:Host' :: Host -> Maybe Text
$sel:providerType:Host' :: Host -> Maybe ProviderType
$sel:providerEndpoint:Host' :: Host -> Maybe Text
$sel:name:Host' :: Host -> Maybe Text
$sel:hostArn:Host' :: Host -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
hostArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
providerEndpoint
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ProviderType
providerType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
status
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
statusMessage
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe VpcConfiguration
vpcConfiguration