{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.OpsWorksCM.DescribeServers
-- 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)
--
-- Lists all configuration management servers that are identified with your
-- account. Only the stored results from Amazon DynamoDB are returned. AWS
-- OpsWorks CM does not query other services.
--
-- This operation is synchronous.
--
-- A @ResourceNotFoundException@ is thrown when the server does not exist.
-- A @ValidationException@ is raised when parameters of the request are not
-- valid.
--
-- This operation returns paginated results.
module Amazonka.OpsWorksCM.DescribeServers
  ( -- * Creating a Request
    DescribeServers (..),
    newDescribeServers,

    -- * Request Lenses
    describeServers_serverName,
    describeServers_nextToken,
    describeServers_maxResults,

    -- * Destructuring the Response
    DescribeServersResponse (..),
    newDescribeServersResponse,

    -- * Response Lenses
    describeServersResponse_servers,
    describeServersResponse_nextToken,
    describeServersResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.OpsWorksCM.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newDescribeServers' smart constructor.
data DescribeServers = DescribeServers'
  { -- | Describes the server with the specified ServerName.
    DescribeServers -> Maybe Text
serverName :: Prelude.Maybe Prelude.Text,
    -- | This is not currently implemented for @DescribeServers@ requests.
    DescribeServers -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | This is not currently implemented for @DescribeServers@ requests.
    DescribeServers -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (DescribeServers -> DescribeServers -> Bool
(DescribeServers -> DescribeServers -> Bool)
-> (DescribeServers -> DescribeServers -> Bool)
-> Eq DescribeServers
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeServers -> DescribeServers -> Bool
$c/= :: DescribeServers -> DescribeServers -> Bool
== :: DescribeServers -> DescribeServers -> Bool
$c== :: DescribeServers -> DescribeServers -> Bool
Prelude.Eq, ReadPrec [DescribeServers]
ReadPrec DescribeServers
Int -> ReadS DescribeServers
ReadS [DescribeServers]
(Int -> ReadS DescribeServers)
-> ReadS [DescribeServers]
-> ReadPrec DescribeServers
-> ReadPrec [DescribeServers]
-> Read DescribeServers
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeServers]
$creadListPrec :: ReadPrec [DescribeServers]
readPrec :: ReadPrec DescribeServers
$creadPrec :: ReadPrec DescribeServers
readList :: ReadS [DescribeServers]
$creadList :: ReadS [DescribeServers]
readsPrec :: Int -> ReadS DescribeServers
$creadsPrec :: Int -> ReadS DescribeServers
Prelude.Read, Int -> DescribeServers -> ShowS
[DescribeServers] -> ShowS
DescribeServers -> String
(Int -> DescribeServers -> ShowS)
-> (DescribeServers -> String)
-> ([DescribeServers] -> ShowS)
-> Show DescribeServers
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeServers] -> ShowS
$cshowList :: [DescribeServers] -> ShowS
show :: DescribeServers -> String
$cshow :: DescribeServers -> String
showsPrec :: Int -> DescribeServers -> ShowS
$cshowsPrec :: Int -> DescribeServers -> ShowS
Prelude.Show, (forall x. DescribeServers -> Rep DescribeServers x)
-> (forall x. Rep DescribeServers x -> DescribeServers)
-> Generic DescribeServers
forall x. Rep DescribeServers x -> DescribeServers
forall x. DescribeServers -> Rep DescribeServers x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeServers x -> DescribeServers
$cfrom :: forall x. DescribeServers -> Rep DescribeServers x
Prelude.Generic)

-- |
-- Create a value of 'DescribeServers' 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:
--
-- 'serverName', 'describeServers_serverName' - Describes the server with the specified ServerName.
--
-- 'nextToken', 'describeServers_nextToken' - This is not currently implemented for @DescribeServers@ requests.
--
-- 'maxResults', 'describeServers_maxResults' - This is not currently implemented for @DescribeServers@ requests.
newDescribeServers ::
  DescribeServers
newDescribeServers :: DescribeServers
newDescribeServers =
  DescribeServers' :: Maybe Text -> Maybe Text -> Maybe Natural -> DescribeServers
DescribeServers'
    { $sel:serverName:DescribeServers' :: Maybe Text
serverName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeServers' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:DescribeServers' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | Describes the server with the specified ServerName.
describeServers_serverName :: Lens.Lens' DescribeServers (Prelude.Maybe Prelude.Text)
describeServers_serverName :: (Maybe Text -> f (Maybe Text))
-> DescribeServers -> f DescribeServers
describeServers_serverName = (DescribeServers -> Maybe Text)
-> (DescribeServers -> Maybe Text -> DescribeServers)
-> Lens DescribeServers DescribeServers (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeServers' {Maybe Text
serverName :: Maybe Text
$sel:serverName:DescribeServers' :: DescribeServers -> Maybe Text
serverName} -> Maybe Text
serverName) (\s :: DescribeServers
s@DescribeServers' {} Maybe Text
a -> DescribeServers
s {$sel:serverName:DescribeServers' :: Maybe Text
serverName = Maybe Text
a} :: DescribeServers)

-- | This is not currently implemented for @DescribeServers@ requests.
describeServers_nextToken :: Lens.Lens' DescribeServers (Prelude.Maybe Prelude.Text)
describeServers_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeServers -> f DescribeServers
describeServers_nextToken = (DescribeServers -> Maybe Text)
-> (DescribeServers -> Maybe Text -> DescribeServers)
-> Lens DescribeServers DescribeServers (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeServers' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeServers' :: DescribeServers -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeServers
s@DescribeServers' {} Maybe Text
a -> DescribeServers
s {$sel:nextToken:DescribeServers' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeServers)

-- | This is not currently implemented for @DescribeServers@ requests.
describeServers_maxResults :: Lens.Lens' DescribeServers (Prelude.Maybe Prelude.Natural)
describeServers_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> DescribeServers -> f DescribeServers
describeServers_maxResults = (DescribeServers -> Maybe Natural)
-> (DescribeServers -> Maybe Natural -> DescribeServers)
-> Lens
     DescribeServers DescribeServers (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeServers' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:DescribeServers' :: DescribeServers -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: DescribeServers
s@DescribeServers' {} Maybe Natural
a -> DescribeServers
s {$sel:maxResults:DescribeServers' :: Maybe Natural
maxResults = Maybe Natural
a} :: DescribeServers)

instance Core.AWSPager DescribeServers where
  page :: DescribeServers
-> AWSResponse DescribeServers -> Maybe DescribeServers
page DescribeServers
rq AWSResponse DescribeServers
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeServers
DescribeServersResponse
rs
            DescribeServersResponse
-> Getting (First Text) DescribeServersResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeServersResponse
-> Const (First Text) DescribeServersResponse
Lens' DescribeServersResponse (Maybe Text)
describeServersResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeServersResponse
 -> Const (First Text) DescribeServersResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeServersResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe DescribeServers
forall a. Maybe a
Prelude.Nothing
    | Maybe [Server] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeServers
DescribeServersResponse
rs
            DescribeServersResponse
-> Getting (First [Server]) DescribeServersResponse [Server]
-> Maybe [Server]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [Server] -> Const (First [Server]) (Maybe [Server]))
-> DescribeServersResponse
-> Const (First [Server]) DescribeServersResponse
Lens' DescribeServersResponse (Maybe [Server])
describeServersResponse_servers ((Maybe [Server] -> Const (First [Server]) (Maybe [Server]))
 -> DescribeServersResponse
 -> Const (First [Server]) DescribeServersResponse)
-> (([Server] -> Const (First [Server]) [Server])
    -> Maybe [Server] -> Const (First [Server]) (Maybe [Server]))
-> Getting (First [Server]) DescribeServersResponse [Server]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Server] -> Const (First [Server]) [Server])
-> Maybe [Server] -> Const (First [Server]) (Maybe [Server])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe DescribeServers
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      DescribeServers -> Maybe DescribeServers
forall a. a -> Maybe a
Prelude.Just (DescribeServers -> Maybe DescribeServers)
-> DescribeServers -> Maybe DescribeServers
forall a b. (a -> b) -> a -> b
Prelude.$
        DescribeServers
rq
          DescribeServers
-> (DescribeServers -> DescribeServers) -> DescribeServers
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> DescribeServers -> Identity DescribeServers
Lens DescribeServers DescribeServers (Maybe Text) (Maybe Text)
describeServers_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> DescribeServers -> Identity DescribeServers)
-> Maybe Text -> DescribeServers -> DescribeServers
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DescribeServers
DescribeServersResponse
rs
          DescribeServersResponse
-> Getting (First Text) DescribeServersResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeServersResponse
-> Const (First Text) DescribeServersResponse
Lens' DescribeServersResponse (Maybe Text)
describeServersResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeServersResponse
 -> Const (First Text) DescribeServersResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeServersResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest DescribeServers where
  type
    AWSResponse DescribeServers =
      DescribeServersResponse
  request :: DescribeServers -> Request DescribeServers
request = Service -> DescribeServers -> Request DescribeServers
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeServers
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeServers)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeServers))
-> Logger
-> Service
-> Proxy DescribeServers
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeServers)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe [Server] -> Maybe Text -> Int -> DescribeServersResponse
DescribeServersResponse'
            (Maybe [Server] -> Maybe Text -> Int -> DescribeServersResponse)
-> Either String (Maybe [Server])
-> Either String (Maybe Text -> Int -> DescribeServersResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [Server]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Servers" Either String (Maybe (Maybe [Server]))
-> Maybe [Server] -> Either String (Maybe [Server])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Server]
forall a. Monoid a => a
Prelude.mempty)
            Either String (Maybe Text -> Int -> DescribeServersResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DescribeServersResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"NextToken")
            Either String (Int -> DescribeServersResponse)
-> Either String Int -> Either String DescribeServersResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DescribeServers

instance Prelude.NFData DescribeServers

instance Core.ToHeaders DescribeServers where
  toHeaders :: DescribeServers -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeServers -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"OpsWorksCM_V2016_11_01.DescribeServers" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON DescribeServers where
  toJSON :: DescribeServers -> Value
toJSON DescribeServers' {Maybe Natural
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
serverName :: Maybe Text
$sel:maxResults:DescribeServers' :: DescribeServers -> Maybe Natural
$sel:nextToken:DescribeServers' :: DescribeServers -> Maybe Text
$sel:serverName:DescribeServers' :: DescribeServers -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"ServerName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
serverName,
            (Text
"NextToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
            (Text
"MaxResults" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults
          ]
      )

instance Core.ToPath DescribeServers where
  toPath :: DescribeServers -> ByteString
toPath = ByteString -> DescribeServers -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery DescribeServers where
  toQuery :: DescribeServers -> QueryString
toQuery = QueryString -> DescribeServers -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newDescribeServersResponse' smart constructor.
data DescribeServersResponse = DescribeServersResponse'
  { -- | Contains the response to a @DescribeServers@ request.
    --
    -- /For Chef Automate servers:/ If
    -- @DescribeServersResponse$Servers$EngineAttributes@ includes
    -- CHEF_MAJOR_UPGRADE_AVAILABLE, you can upgrade the Chef Automate server
    -- to Chef Automate 2. To be eligible for upgrade, a server running Chef
    -- Automate 1 must have had at least one successful maintenance run after
    -- November 1, 2019.
    --
    -- /For Puppet servers:/ @DescribeServersResponse$Servers$EngineAttributes@
    -- contains the following two responses:
    --
    -- -   @PUPPET_API_CA_CERT@, the PEM-encoded CA certificate that is used by
    --     the Puppet API over TCP port number 8140. The CA certificate is also
    --     used to sign node certificates.
    --
    -- -   @PUPPET_API_CRL@, a certificate revocation list. The certificate
    --     revocation list is for internal maintenance purposes only. For more
    --     information about the Puppet certificate revocation list, see
    --     <https://puppet.com/docs/puppet/5.5/man/certificate_revocation_list.html Man Page: puppet certificate_revocation_list>
    --     in the Puppet documentation.
    DescribeServersResponse -> Maybe [Server]
servers :: Prelude.Maybe [Server],
    -- | This is not currently implemented for @DescribeServers@ requests.
    DescribeServersResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DescribeServersResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeServersResponse -> DescribeServersResponse -> Bool
(DescribeServersResponse -> DescribeServersResponse -> Bool)
-> (DescribeServersResponse -> DescribeServersResponse -> Bool)
-> Eq DescribeServersResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeServersResponse -> DescribeServersResponse -> Bool
$c/= :: DescribeServersResponse -> DescribeServersResponse -> Bool
== :: DescribeServersResponse -> DescribeServersResponse -> Bool
$c== :: DescribeServersResponse -> DescribeServersResponse -> Bool
Prelude.Eq, Int -> DescribeServersResponse -> ShowS
[DescribeServersResponse] -> ShowS
DescribeServersResponse -> String
(Int -> DescribeServersResponse -> ShowS)
-> (DescribeServersResponse -> String)
-> ([DescribeServersResponse] -> ShowS)
-> Show DescribeServersResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeServersResponse] -> ShowS
$cshowList :: [DescribeServersResponse] -> ShowS
show :: DescribeServersResponse -> String
$cshow :: DescribeServersResponse -> String
showsPrec :: Int -> DescribeServersResponse -> ShowS
$cshowsPrec :: Int -> DescribeServersResponse -> ShowS
Prelude.Show, (forall x.
 DescribeServersResponse -> Rep DescribeServersResponse x)
-> (forall x.
    Rep DescribeServersResponse x -> DescribeServersResponse)
-> Generic DescribeServersResponse
forall x. Rep DescribeServersResponse x -> DescribeServersResponse
forall x. DescribeServersResponse -> Rep DescribeServersResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeServersResponse x -> DescribeServersResponse
$cfrom :: forall x. DescribeServersResponse -> Rep DescribeServersResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeServersResponse' 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:
--
-- 'servers', 'describeServersResponse_servers' - Contains the response to a @DescribeServers@ request.
--
-- /For Chef Automate servers:/ If
-- @DescribeServersResponse$Servers$EngineAttributes@ includes
-- CHEF_MAJOR_UPGRADE_AVAILABLE, you can upgrade the Chef Automate server
-- to Chef Automate 2. To be eligible for upgrade, a server running Chef
-- Automate 1 must have had at least one successful maintenance run after
-- November 1, 2019.
--
-- /For Puppet servers:/ @DescribeServersResponse$Servers$EngineAttributes@
-- contains the following two responses:
--
-- -   @PUPPET_API_CA_CERT@, the PEM-encoded CA certificate that is used by
--     the Puppet API over TCP port number 8140. The CA certificate is also
--     used to sign node certificates.
--
-- -   @PUPPET_API_CRL@, a certificate revocation list. The certificate
--     revocation list is for internal maintenance purposes only. For more
--     information about the Puppet certificate revocation list, see
--     <https://puppet.com/docs/puppet/5.5/man/certificate_revocation_list.html Man Page: puppet certificate_revocation_list>
--     in the Puppet documentation.
--
-- 'nextToken', 'describeServersResponse_nextToken' - This is not currently implemented for @DescribeServers@ requests.
--
-- 'httpStatus', 'describeServersResponse_httpStatus' - The response's http status code.
newDescribeServersResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeServersResponse
newDescribeServersResponse :: Int -> DescribeServersResponse
newDescribeServersResponse Int
pHttpStatus_ =
  DescribeServersResponse' :: Maybe [Server] -> Maybe Text -> Int -> DescribeServersResponse
DescribeServersResponse'
    { $sel:servers:DescribeServersResponse' :: Maybe [Server]
servers = Maybe [Server]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeServersResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeServersResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Contains the response to a @DescribeServers@ request.
--
-- /For Chef Automate servers:/ If
-- @DescribeServersResponse$Servers$EngineAttributes@ includes
-- CHEF_MAJOR_UPGRADE_AVAILABLE, you can upgrade the Chef Automate server
-- to Chef Automate 2. To be eligible for upgrade, a server running Chef
-- Automate 1 must have had at least one successful maintenance run after
-- November 1, 2019.
--
-- /For Puppet servers:/ @DescribeServersResponse$Servers$EngineAttributes@
-- contains the following two responses:
--
-- -   @PUPPET_API_CA_CERT@, the PEM-encoded CA certificate that is used by
--     the Puppet API over TCP port number 8140. The CA certificate is also
--     used to sign node certificates.
--
-- -   @PUPPET_API_CRL@, a certificate revocation list. The certificate
--     revocation list is for internal maintenance purposes only. For more
--     information about the Puppet certificate revocation list, see
--     <https://puppet.com/docs/puppet/5.5/man/certificate_revocation_list.html Man Page: puppet certificate_revocation_list>
--     in the Puppet documentation.
describeServersResponse_servers :: Lens.Lens' DescribeServersResponse (Prelude.Maybe [Server])
describeServersResponse_servers :: (Maybe [Server] -> f (Maybe [Server]))
-> DescribeServersResponse -> f DescribeServersResponse
describeServersResponse_servers = (DescribeServersResponse -> Maybe [Server])
-> (DescribeServersResponse
    -> Maybe [Server] -> DescribeServersResponse)
-> Lens' DescribeServersResponse (Maybe [Server])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeServersResponse' {Maybe [Server]
servers :: Maybe [Server]
$sel:servers:DescribeServersResponse' :: DescribeServersResponse -> Maybe [Server]
servers} -> Maybe [Server]
servers) (\s :: DescribeServersResponse
s@DescribeServersResponse' {} Maybe [Server]
a -> DescribeServersResponse
s {$sel:servers:DescribeServersResponse' :: Maybe [Server]
servers = Maybe [Server]
a} :: DescribeServersResponse) ((Maybe [Server] -> f (Maybe [Server]))
 -> DescribeServersResponse -> f DescribeServersResponse)
-> ((Maybe [Server] -> f (Maybe [Server]))
    -> Maybe [Server] -> f (Maybe [Server]))
-> (Maybe [Server] -> f (Maybe [Server]))
-> DescribeServersResponse
-> f DescribeServersResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Server] [Server] [Server] [Server]
-> Iso
     (Maybe [Server]) (Maybe [Server]) (Maybe [Server]) (Maybe [Server])
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 AnIso [Server] [Server] [Server] [Server]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | This is not currently implemented for @DescribeServers@ requests.
describeServersResponse_nextToken :: Lens.Lens' DescribeServersResponse (Prelude.Maybe Prelude.Text)
describeServersResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeServersResponse -> f DescribeServersResponse
describeServersResponse_nextToken = (DescribeServersResponse -> Maybe Text)
-> (DescribeServersResponse
    -> Maybe Text -> DescribeServersResponse)
-> Lens' DescribeServersResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeServersResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeServersResponse' :: DescribeServersResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeServersResponse
s@DescribeServersResponse' {} Maybe Text
a -> DescribeServersResponse
s {$sel:nextToken:DescribeServersResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeServersResponse)

-- | The response's http status code.
describeServersResponse_httpStatus :: Lens.Lens' DescribeServersResponse Prelude.Int
describeServersResponse_httpStatus :: (Int -> f Int)
-> DescribeServersResponse -> f DescribeServersResponse
describeServersResponse_httpStatus = (DescribeServersResponse -> Int)
-> (DescribeServersResponse -> Int -> DescribeServersResponse)
-> Lens DescribeServersResponse DescribeServersResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeServersResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeServersResponse' :: DescribeServersResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeServersResponse
s@DescribeServersResponse' {} Int
a -> DescribeServersResponse
s {$sel:httpStatus:DescribeServersResponse' :: Int
httpStatus = Int
a} :: DescribeServersResponse)

instance Prelude.NFData DescribeServersResponse