{-# 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.EC2.DescribeHosts
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Describes the specified Dedicated Hosts or all your Dedicated Hosts.
--
-- The results describe only the Dedicated Hosts in the Region you\'re
-- currently using. All listed instances consume capacity on your Dedicated
-- Host. Dedicated Hosts that have recently been released are listed with
-- the state @released@.
--
-- This operation returns paginated results.
module Amazonka.EC2.DescribeHosts
  ( -- * Creating a Request
    DescribeHosts (..),
    newDescribeHosts,

    -- * Request Lenses
    describeHosts_filter,
    describeHosts_hostIds,
    describeHosts_maxResults,
    describeHosts_nextToken,

    -- * Destructuring the Response
    DescribeHostsResponse (..),
    newDescribeHostsResponse,

    -- * Response Lenses
    describeHostsResponse_hosts,
    describeHostsResponse_nextToken,
    describeHostsResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.EC2.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newDescribeHosts' smart constructor.
data DescribeHosts = DescribeHosts'
  { -- | The filters.
    --
    -- -   @auto-placement@ - Whether auto-placement is enabled or disabled
    --     (@on@ | @off@).
    --
    -- -   @availability-zone@ - The Availability Zone of the host.
    --
    -- -   @client-token@ - The idempotency token that you provided when you
    --     allocated the host.
    --
    -- -   @host-reservation-id@ - The ID of the reservation assigned to this
    --     host.
    --
    -- -   @instance-type@ - The instance type size that the Dedicated Host is
    --     configured to support.
    --
    -- -   @state@ - The allocation state of the Dedicated Host (@available@ |
    --     @under-assessment@ | @permanent-failure@ | @released@ |
    --     @released-permanent-failure@).
    --
    -- -   @tag-key@ - The key of a tag assigned to the resource. Use this
    --     filter to find all resources assigned a tag with a specific key,
    --     regardless of the tag value.
    DescribeHosts -> Maybe [Filter]
filter' :: Prelude.Maybe [Filter],
    -- | The IDs of the Dedicated Hosts. The IDs are used for targeted instance
    -- launches.
    DescribeHosts -> Maybe [Text]
hostIds :: Prelude.Maybe [Prelude.Text],
    -- | The maximum number of results to return for the request in a single
    -- page. The remaining results can be seen by sending another request with
    -- the returned @nextToken@ value. This value can be between 5 and 500. If
    -- @maxResults@ is given a larger value than 500, you receive an error.
    --
    -- You cannot specify this parameter and the host IDs parameter in the same
    -- request.
    DescribeHosts -> Maybe Int
maxResults :: Prelude.Maybe Prelude.Int,
    -- | The token to use to retrieve the next page of results.
    DescribeHosts -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
  }
  deriving (DescribeHosts -> DescribeHosts -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeHosts -> DescribeHosts -> Bool
$c/= :: DescribeHosts -> DescribeHosts -> Bool
== :: DescribeHosts -> DescribeHosts -> Bool
$c== :: DescribeHosts -> DescribeHosts -> Bool
Prelude.Eq, ReadPrec [DescribeHosts]
ReadPrec DescribeHosts
Int -> ReadS DescribeHosts
ReadS [DescribeHosts]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeHosts]
$creadListPrec :: ReadPrec [DescribeHosts]
readPrec :: ReadPrec DescribeHosts
$creadPrec :: ReadPrec DescribeHosts
readList :: ReadS [DescribeHosts]
$creadList :: ReadS [DescribeHosts]
readsPrec :: Int -> ReadS DescribeHosts
$creadsPrec :: Int -> ReadS DescribeHosts
Prelude.Read, Int -> DescribeHosts -> ShowS
[DescribeHosts] -> ShowS
DescribeHosts -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeHosts] -> ShowS
$cshowList :: [DescribeHosts] -> ShowS
show :: DescribeHosts -> String
$cshow :: DescribeHosts -> String
showsPrec :: Int -> DescribeHosts -> ShowS
$cshowsPrec :: Int -> DescribeHosts -> ShowS
Prelude.Show, forall x. Rep DescribeHosts x -> DescribeHosts
forall x. DescribeHosts -> Rep DescribeHosts x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeHosts x -> DescribeHosts
$cfrom :: forall x. DescribeHosts -> Rep DescribeHosts x
Prelude.Generic)

-- |
-- Create a value of 'DescribeHosts' 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:
--
-- 'filter'', 'describeHosts_filter' - The filters.
--
-- -   @auto-placement@ - Whether auto-placement is enabled or disabled
--     (@on@ | @off@).
--
-- -   @availability-zone@ - The Availability Zone of the host.
--
-- -   @client-token@ - The idempotency token that you provided when you
--     allocated the host.
--
-- -   @host-reservation-id@ - The ID of the reservation assigned to this
--     host.
--
-- -   @instance-type@ - The instance type size that the Dedicated Host is
--     configured to support.
--
-- -   @state@ - The allocation state of the Dedicated Host (@available@ |
--     @under-assessment@ | @permanent-failure@ | @released@ |
--     @released-permanent-failure@).
--
-- -   @tag-key@ - The key of a tag assigned to the resource. Use this
--     filter to find all resources assigned a tag with a specific key,
--     regardless of the tag value.
--
-- 'hostIds', 'describeHosts_hostIds' - The IDs of the Dedicated Hosts. The IDs are used for targeted instance
-- launches.
--
-- 'maxResults', 'describeHosts_maxResults' - The maximum number of results to return for the request in a single
-- page. The remaining results can be seen by sending another request with
-- the returned @nextToken@ value. This value can be between 5 and 500. If
-- @maxResults@ is given a larger value than 500, you receive an error.
--
-- You cannot specify this parameter and the host IDs parameter in the same
-- request.
--
-- 'nextToken', 'describeHosts_nextToken' - The token to use to retrieve the next page of results.
newDescribeHosts ::
  DescribeHosts
newDescribeHosts :: DescribeHosts
newDescribeHosts =
  DescribeHosts'
    { $sel:filter':DescribeHosts' :: Maybe [Filter]
filter' = forall a. Maybe a
Prelude.Nothing,
      $sel:hostIds:DescribeHosts' :: Maybe [Text]
hostIds = forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:DescribeHosts' :: Maybe Int
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeHosts' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
    }

-- | The filters.
--
-- -   @auto-placement@ - Whether auto-placement is enabled or disabled
--     (@on@ | @off@).
--
-- -   @availability-zone@ - The Availability Zone of the host.
--
-- -   @client-token@ - The idempotency token that you provided when you
--     allocated the host.
--
-- -   @host-reservation-id@ - The ID of the reservation assigned to this
--     host.
--
-- -   @instance-type@ - The instance type size that the Dedicated Host is
--     configured to support.
--
-- -   @state@ - The allocation state of the Dedicated Host (@available@ |
--     @under-assessment@ | @permanent-failure@ | @released@ |
--     @released-permanent-failure@).
--
-- -   @tag-key@ - The key of a tag assigned to the resource. Use this
--     filter to find all resources assigned a tag with a specific key,
--     regardless of the tag value.
describeHosts_filter :: Lens.Lens' DescribeHosts (Prelude.Maybe [Filter])
describeHosts_filter :: Lens' DescribeHosts (Maybe [Filter])
describeHosts_filter = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeHosts' {Maybe [Filter]
filter' :: Maybe [Filter]
$sel:filter':DescribeHosts' :: DescribeHosts -> Maybe [Filter]
filter'} -> Maybe [Filter]
filter') (\s :: DescribeHosts
s@DescribeHosts' {} Maybe [Filter]
a -> DescribeHosts
s {$sel:filter':DescribeHosts' :: Maybe [Filter]
filter' = Maybe [Filter]
a} :: DescribeHosts) 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 IDs of the Dedicated Hosts. The IDs are used for targeted instance
-- launches.
describeHosts_hostIds :: Lens.Lens' DescribeHosts (Prelude.Maybe [Prelude.Text])
describeHosts_hostIds :: Lens' DescribeHosts (Maybe [Text])
describeHosts_hostIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeHosts' {Maybe [Text]
hostIds :: Maybe [Text]
$sel:hostIds:DescribeHosts' :: DescribeHosts -> Maybe [Text]
hostIds} -> Maybe [Text]
hostIds) (\s :: DescribeHosts
s@DescribeHosts' {} Maybe [Text]
a -> DescribeHosts
s {$sel:hostIds:DescribeHosts' :: Maybe [Text]
hostIds = Maybe [Text]
a} :: DescribeHosts) 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 maximum number of results to return for the request in a single
-- page. The remaining results can be seen by sending another request with
-- the returned @nextToken@ value. This value can be between 5 and 500. If
-- @maxResults@ is given a larger value than 500, you receive an error.
--
-- You cannot specify this parameter and the host IDs parameter in the same
-- request.
describeHosts_maxResults :: Lens.Lens' DescribeHosts (Prelude.Maybe Prelude.Int)
describeHosts_maxResults :: Lens' DescribeHosts (Maybe Int)
describeHosts_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeHosts' {Maybe Int
maxResults :: Maybe Int
$sel:maxResults:DescribeHosts' :: DescribeHosts -> Maybe Int
maxResults} -> Maybe Int
maxResults) (\s :: DescribeHosts
s@DescribeHosts' {} Maybe Int
a -> DescribeHosts
s {$sel:maxResults:DescribeHosts' :: Maybe Int
maxResults = Maybe Int
a} :: DescribeHosts)

-- | The token to use to retrieve the next page of results.
describeHosts_nextToken :: Lens.Lens' DescribeHosts (Prelude.Maybe Prelude.Text)
describeHosts_nextToken :: Lens' DescribeHosts (Maybe Text)
describeHosts_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeHosts' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeHosts' :: DescribeHosts -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeHosts
s@DescribeHosts' {} Maybe Text
a -> DescribeHosts
s {$sel:nextToken:DescribeHosts' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeHosts)

instance Core.AWSPager DescribeHosts where
  page :: DescribeHosts -> AWSResponse DescribeHosts -> Maybe DescribeHosts
page DescribeHosts
rq AWSResponse DescribeHosts
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeHosts
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' DescribeHostsResponse (Maybe Text)
describeHostsResponse_nextToken
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeHosts
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' DescribeHostsResponse (Maybe [Host])
describeHostsResponse_hosts
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
        forall a. a -> Maybe a
Prelude.Just
          forall a b. (a -> b) -> a -> b
Prelude.$ DescribeHosts
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' DescribeHosts (Maybe Text)
describeHosts_nextToken
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DescribeHosts
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' DescribeHostsResponse (Maybe Text)
describeHostsResponse_nextToken
          forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest DescribeHosts where
  type
    AWSResponse DescribeHosts =
      DescribeHostsResponse
  request :: (Service -> Service) -> DescribeHosts -> Request DescribeHosts
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.postQuery (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DescribeHosts
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeHosts)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXML
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe [Host] -> Maybe Text -> Int -> DescribeHostsResponse
DescribeHostsResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( [Node]
x
                            forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"hostSet"
                            forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                            forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (forall a. FromXML a => Text -> [Node] -> Either String [a]
Data.parseXMLList Text
"item")
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"nextToken")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DescribeHosts where
  hashWithSalt :: Int -> DescribeHosts -> Int
hashWithSalt Int
_salt DescribeHosts' {Maybe Int
Maybe [Text]
Maybe [Filter]
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Int
hostIds :: Maybe [Text]
filter' :: Maybe [Filter]
$sel:nextToken:DescribeHosts' :: DescribeHosts -> Maybe Text
$sel:maxResults:DescribeHosts' :: DescribeHosts -> Maybe Int
$sel:hostIds:DescribeHosts' :: DescribeHosts -> Maybe [Text]
$sel:filter':DescribeHosts' :: DescribeHosts -> Maybe [Filter]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Filter]
filter'
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
hostIds
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
maxResults
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken

instance Prelude.NFData DescribeHosts where
  rnf :: DescribeHosts -> ()
rnf DescribeHosts' {Maybe Int
Maybe [Text]
Maybe [Filter]
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Int
hostIds :: Maybe [Text]
filter' :: Maybe [Filter]
$sel:nextToken:DescribeHosts' :: DescribeHosts -> Maybe Text
$sel:maxResults:DescribeHosts' :: DescribeHosts -> Maybe Int
$sel:hostIds:DescribeHosts' :: DescribeHosts -> Maybe [Text]
$sel:filter':DescribeHosts' :: DescribeHosts -> Maybe [Filter]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Filter]
filter'
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
hostIds
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
maxResults
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken

instance Data.ToHeaders DescribeHosts where
  toHeaders :: DescribeHosts -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

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

instance Data.ToQuery DescribeHosts where
  toQuery :: DescribeHosts -> QueryString
toQuery DescribeHosts' {Maybe Int
Maybe [Text]
Maybe [Filter]
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Int
hostIds :: Maybe [Text]
filter' :: Maybe [Filter]
$sel:nextToken:DescribeHosts' :: DescribeHosts -> Maybe Text
$sel:maxResults:DescribeHosts' :: DescribeHosts -> Maybe Int
$sel:hostIds:DescribeHosts' :: DescribeHosts -> Maybe [Text]
$sel:filter':DescribeHosts' :: DescribeHosts -> Maybe [Filter]
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"DescribeHosts" :: Prelude.ByteString),
        ByteString
"Version"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2016-11-15" :: Prelude.ByteString),
        forall a. ToQuery a => a -> QueryString
Data.toQuery
          (forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Data.toQueryList ByteString
"Filter" forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Filter]
filter'),
        forall a. ToQuery a => a -> QueryString
Data.toQuery
          (forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Data.toQueryList ByteString
"HostId" forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
hostIds),
        ByteString
"MaxResults" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Int
maxResults,
        ByteString
"NextToken" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
nextToken
      ]

-- | /See:/ 'newDescribeHostsResponse' smart constructor.
data DescribeHostsResponse = DescribeHostsResponse'
  { -- | Information about the Dedicated Hosts.
    DescribeHostsResponse -> Maybe [Host]
hosts :: Prelude.Maybe [Host],
    -- | The token to use to retrieve the next page of results. This value is
    -- @null@ when there are no more results to return.
    DescribeHostsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DescribeHostsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeHostsResponse -> DescribeHostsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeHostsResponse -> DescribeHostsResponse -> Bool
$c/= :: DescribeHostsResponse -> DescribeHostsResponse -> Bool
== :: DescribeHostsResponse -> DescribeHostsResponse -> Bool
$c== :: DescribeHostsResponse -> DescribeHostsResponse -> Bool
Prelude.Eq, ReadPrec [DescribeHostsResponse]
ReadPrec DescribeHostsResponse
Int -> ReadS DescribeHostsResponse
ReadS [DescribeHostsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeHostsResponse]
$creadListPrec :: ReadPrec [DescribeHostsResponse]
readPrec :: ReadPrec DescribeHostsResponse
$creadPrec :: ReadPrec DescribeHostsResponse
readList :: ReadS [DescribeHostsResponse]
$creadList :: ReadS [DescribeHostsResponse]
readsPrec :: Int -> ReadS DescribeHostsResponse
$creadsPrec :: Int -> ReadS DescribeHostsResponse
Prelude.Read, Int -> DescribeHostsResponse -> ShowS
[DescribeHostsResponse] -> ShowS
DescribeHostsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeHostsResponse] -> ShowS
$cshowList :: [DescribeHostsResponse] -> ShowS
show :: DescribeHostsResponse -> String
$cshow :: DescribeHostsResponse -> String
showsPrec :: Int -> DescribeHostsResponse -> ShowS
$cshowsPrec :: Int -> DescribeHostsResponse -> ShowS
Prelude.Show, forall x. Rep DescribeHostsResponse x -> DescribeHostsResponse
forall x. DescribeHostsResponse -> Rep DescribeHostsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeHostsResponse x -> DescribeHostsResponse
$cfrom :: forall x. DescribeHostsResponse -> Rep DescribeHostsResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeHostsResponse' 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:
--
-- 'hosts', 'describeHostsResponse_hosts' - Information about the Dedicated Hosts.
--
-- 'nextToken', 'describeHostsResponse_nextToken' - The token to use to retrieve the next page of results. This value is
-- @null@ when there are no more results to return.
--
-- 'httpStatus', 'describeHostsResponse_httpStatus' - The response's http status code.
newDescribeHostsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeHostsResponse
newDescribeHostsResponse :: Int -> DescribeHostsResponse
newDescribeHostsResponse Int
pHttpStatus_ =
  DescribeHostsResponse'
    { $sel:hosts:DescribeHostsResponse' :: Maybe [Host]
hosts = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeHostsResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeHostsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Information about the Dedicated Hosts.
describeHostsResponse_hosts :: Lens.Lens' DescribeHostsResponse (Prelude.Maybe [Host])
describeHostsResponse_hosts :: Lens' DescribeHostsResponse (Maybe [Host])
describeHostsResponse_hosts = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeHostsResponse' {Maybe [Host]
hosts :: Maybe [Host]
$sel:hosts:DescribeHostsResponse' :: DescribeHostsResponse -> Maybe [Host]
hosts} -> Maybe [Host]
hosts) (\s :: DescribeHostsResponse
s@DescribeHostsResponse' {} Maybe [Host]
a -> DescribeHostsResponse
s {$sel:hosts:DescribeHostsResponse' :: Maybe [Host]
hosts = Maybe [Host]
a} :: DescribeHostsResponse) 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 token to use to retrieve the next page of results. This value is
-- @null@ when there are no more results to return.
describeHostsResponse_nextToken :: Lens.Lens' DescribeHostsResponse (Prelude.Maybe Prelude.Text)
describeHostsResponse_nextToken :: Lens' DescribeHostsResponse (Maybe Text)
describeHostsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeHostsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeHostsResponse' :: DescribeHostsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeHostsResponse
s@DescribeHostsResponse' {} Maybe Text
a -> DescribeHostsResponse
s {$sel:nextToken:DescribeHostsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeHostsResponse)

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

instance Prelude.NFData DescribeHostsResponse where
  rnf :: DescribeHostsResponse -> ()
rnf DescribeHostsResponse' {Int
Maybe [Host]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
hosts :: Maybe [Host]
$sel:httpStatus:DescribeHostsResponse' :: DescribeHostsResponse -> Int
$sel:nextToken:DescribeHostsResponse' :: DescribeHostsResponse -> Maybe Text
$sel:hosts:DescribeHostsResponse' :: DescribeHostsResponse -> Maybe [Host]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Host]
hosts
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus