{-# 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.OpenSearch.UpgradeDomain
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Allows you to either upgrade your Amazon OpenSearch Service domain or
-- perform an upgrade eligibility check to a compatible version of
-- OpenSearch or Elasticsearch.
module Amazonka.OpenSearch.UpgradeDomain
  ( -- * Creating a Request
    UpgradeDomain (..),
    newUpgradeDomain,

    -- * Request Lenses
    upgradeDomain_advancedOptions,
    upgradeDomain_performCheckOnly,
    upgradeDomain_domainName,
    upgradeDomain_targetVersion,

    -- * Destructuring the Response
    UpgradeDomainResponse (..),
    newUpgradeDomainResponse,

    -- * Response Lenses
    upgradeDomainResponse_advancedOptions,
    upgradeDomainResponse_changeProgressDetails,
    upgradeDomainResponse_domainName,
    upgradeDomainResponse_performCheckOnly,
    upgradeDomainResponse_targetVersion,
    upgradeDomainResponse_upgradeId,
    upgradeDomainResponse_httpStatus,
  )
where

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

-- | Container for the request parameters to the @UpgradeDomain@ operation.
--
-- /See:/ 'newUpgradeDomain' smart constructor.
data UpgradeDomain = UpgradeDomain'
  { -- | Only supports the @override_main_response_version@ parameter and not
    -- other advanced options. You can only include this option when upgrading
    -- to an OpenSearch version. Specifies whether the domain reports its
    -- version as 7.10 so that it continues to work with Elasticsearch OSS
    -- clients and plugins.
    UpgradeDomain -> Maybe (HashMap Text Text)
advancedOptions :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | When true, indicates that an upgrade eligibility check needs to be
    -- performed. Does not actually perform the upgrade.
    UpgradeDomain -> Maybe Bool
performCheckOnly :: Prelude.Maybe Prelude.Bool,
    -- | Name of the OpenSearch Service domain that you want to upgrade.
    UpgradeDomain -> Text
domainName :: Prelude.Text,
    -- | OpenSearch or Elasticsearch version to which you want to upgrade, in the
    -- format Opensearch_X.Y or Elasticsearch_X.Y.
    UpgradeDomain -> Text
targetVersion :: Prelude.Text
  }
  deriving (UpgradeDomain -> UpgradeDomain -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpgradeDomain -> UpgradeDomain -> Bool
$c/= :: UpgradeDomain -> UpgradeDomain -> Bool
== :: UpgradeDomain -> UpgradeDomain -> Bool
$c== :: UpgradeDomain -> UpgradeDomain -> Bool
Prelude.Eq, ReadPrec [UpgradeDomain]
ReadPrec UpgradeDomain
Int -> ReadS UpgradeDomain
ReadS [UpgradeDomain]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpgradeDomain]
$creadListPrec :: ReadPrec [UpgradeDomain]
readPrec :: ReadPrec UpgradeDomain
$creadPrec :: ReadPrec UpgradeDomain
readList :: ReadS [UpgradeDomain]
$creadList :: ReadS [UpgradeDomain]
readsPrec :: Int -> ReadS UpgradeDomain
$creadsPrec :: Int -> ReadS UpgradeDomain
Prelude.Read, Int -> UpgradeDomain -> ShowS
[UpgradeDomain] -> ShowS
UpgradeDomain -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpgradeDomain] -> ShowS
$cshowList :: [UpgradeDomain] -> ShowS
show :: UpgradeDomain -> String
$cshow :: UpgradeDomain -> String
showsPrec :: Int -> UpgradeDomain -> ShowS
$cshowsPrec :: Int -> UpgradeDomain -> ShowS
Prelude.Show, forall x. Rep UpgradeDomain x -> UpgradeDomain
forall x. UpgradeDomain -> Rep UpgradeDomain x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpgradeDomain x -> UpgradeDomain
$cfrom :: forall x. UpgradeDomain -> Rep UpgradeDomain x
Prelude.Generic)

-- |
-- Create a value of 'UpgradeDomain' 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:
--
-- 'advancedOptions', 'upgradeDomain_advancedOptions' - Only supports the @override_main_response_version@ parameter and not
-- other advanced options. You can only include this option when upgrading
-- to an OpenSearch version. Specifies whether the domain reports its
-- version as 7.10 so that it continues to work with Elasticsearch OSS
-- clients and plugins.
--
-- 'performCheckOnly', 'upgradeDomain_performCheckOnly' - When true, indicates that an upgrade eligibility check needs to be
-- performed. Does not actually perform the upgrade.
--
-- 'domainName', 'upgradeDomain_domainName' - Name of the OpenSearch Service domain that you want to upgrade.
--
-- 'targetVersion', 'upgradeDomain_targetVersion' - OpenSearch or Elasticsearch version to which you want to upgrade, in the
-- format Opensearch_X.Y or Elasticsearch_X.Y.
newUpgradeDomain ::
  -- | 'domainName'
  Prelude.Text ->
  -- | 'targetVersion'
  Prelude.Text ->
  UpgradeDomain
newUpgradeDomain :: Text -> Text -> UpgradeDomain
newUpgradeDomain Text
pDomainName_ Text
pTargetVersion_ =
  UpgradeDomain'
    { $sel:advancedOptions:UpgradeDomain' :: Maybe (HashMap Text Text)
advancedOptions = forall a. Maybe a
Prelude.Nothing,
      $sel:performCheckOnly:UpgradeDomain' :: Maybe Bool
performCheckOnly = forall a. Maybe a
Prelude.Nothing,
      $sel:domainName:UpgradeDomain' :: Text
domainName = Text
pDomainName_,
      $sel:targetVersion:UpgradeDomain' :: Text
targetVersion = Text
pTargetVersion_
    }

-- | Only supports the @override_main_response_version@ parameter and not
-- other advanced options. You can only include this option when upgrading
-- to an OpenSearch version. Specifies whether the domain reports its
-- version as 7.10 so that it continues to work with Elasticsearch OSS
-- clients and plugins.
upgradeDomain_advancedOptions :: Lens.Lens' UpgradeDomain (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
upgradeDomain_advancedOptions :: Lens' UpgradeDomain (Maybe (HashMap Text Text))
upgradeDomain_advancedOptions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpgradeDomain' {Maybe (HashMap Text Text)
advancedOptions :: Maybe (HashMap Text Text)
$sel:advancedOptions:UpgradeDomain' :: UpgradeDomain -> Maybe (HashMap Text Text)
advancedOptions} -> Maybe (HashMap Text Text)
advancedOptions) (\s :: UpgradeDomain
s@UpgradeDomain' {} Maybe (HashMap Text Text)
a -> UpgradeDomain
s {$sel:advancedOptions:UpgradeDomain' :: Maybe (HashMap Text Text)
advancedOptions = Maybe (HashMap Text Text)
a} :: UpgradeDomain) 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

-- | When true, indicates that an upgrade eligibility check needs to be
-- performed. Does not actually perform the upgrade.
upgradeDomain_performCheckOnly :: Lens.Lens' UpgradeDomain (Prelude.Maybe Prelude.Bool)
upgradeDomain_performCheckOnly :: Lens' UpgradeDomain (Maybe Bool)
upgradeDomain_performCheckOnly = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpgradeDomain' {Maybe Bool
performCheckOnly :: Maybe Bool
$sel:performCheckOnly:UpgradeDomain' :: UpgradeDomain -> Maybe Bool
performCheckOnly} -> Maybe Bool
performCheckOnly) (\s :: UpgradeDomain
s@UpgradeDomain' {} Maybe Bool
a -> UpgradeDomain
s {$sel:performCheckOnly:UpgradeDomain' :: Maybe Bool
performCheckOnly = Maybe Bool
a} :: UpgradeDomain)

-- | Name of the OpenSearch Service domain that you want to upgrade.
upgradeDomain_domainName :: Lens.Lens' UpgradeDomain Prelude.Text
upgradeDomain_domainName :: Lens' UpgradeDomain Text
upgradeDomain_domainName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpgradeDomain' {Text
domainName :: Text
$sel:domainName:UpgradeDomain' :: UpgradeDomain -> Text
domainName} -> Text
domainName) (\s :: UpgradeDomain
s@UpgradeDomain' {} Text
a -> UpgradeDomain
s {$sel:domainName:UpgradeDomain' :: Text
domainName = Text
a} :: UpgradeDomain)

-- | OpenSearch or Elasticsearch version to which you want to upgrade, in the
-- format Opensearch_X.Y or Elasticsearch_X.Y.
upgradeDomain_targetVersion :: Lens.Lens' UpgradeDomain Prelude.Text
upgradeDomain_targetVersion :: Lens' UpgradeDomain Text
upgradeDomain_targetVersion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpgradeDomain' {Text
targetVersion :: Text
$sel:targetVersion:UpgradeDomain' :: UpgradeDomain -> Text
targetVersion} -> Text
targetVersion) (\s :: UpgradeDomain
s@UpgradeDomain' {} Text
a -> UpgradeDomain
s {$sel:targetVersion:UpgradeDomain' :: Text
targetVersion = Text
a} :: UpgradeDomain)

instance Core.AWSRequest UpgradeDomain where
  type
    AWSResponse UpgradeDomain =
      UpgradeDomainResponse
  request :: (Service -> Service) -> UpgradeDomain -> Request UpgradeDomain
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy UpgradeDomain
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpgradeDomain)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe (HashMap Text Text)
-> Maybe ChangeProgressDetails
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Int
-> UpgradeDomainResponse
UpgradeDomainResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"AdvancedOptions"
                            forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"ChangeProgressDetails")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"DomainName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"PerformCheckOnly")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"TargetVersion")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"UpgradeId")
            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 UpgradeDomain where
  hashWithSalt :: Int -> UpgradeDomain -> Int
hashWithSalt Int
_salt UpgradeDomain' {Maybe Bool
Maybe (HashMap Text Text)
Text
targetVersion :: Text
domainName :: Text
performCheckOnly :: Maybe Bool
advancedOptions :: Maybe (HashMap Text Text)
$sel:targetVersion:UpgradeDomain' :: UpgradeDomain -> Text
$sel:domainName:UpgradeDomain' :: UpgradeDomain -> Text
$sel:performCheckOnly:UpgradeDomain' :: UpgradeDomain -> Maybe Bool
$sel:advancedOptions:UpgradeDomain' :: UpgradeDomain -> Maybe (HashMap Text Text)
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
advancedOptions
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
performCheckOnly
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
domainName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
targetVersion

instance Prelude.NFData UpgradeDomain where
  rnf :: UpgradeDomain -> ()
rnf UpgradeDomain' {Maybe Bool
Maybe (HashMap Text Text)
Text
targetVersion :: Text
domainName :: Text
performCheckOnly :: Maybe Bool
advancedOptions :: Maybe (HashMap Text Text)
$sel:targetVersion:UpgradeDomain' :: UpgradeDomain -> Text
$sel:domainName:UpgradeDomain' :: UpgradeDomain -> Text
$sel:performCheckOnly:UpgradeDomain' :: UpgradeDomain -> Maybe Bool
$sel:advancedOptions:UpgradeDomain' :: UpgradeDomain -> Maybe (HashMap Text Text)
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
advancedOptions
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
performCheckOnly
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
domainName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
targetVersion

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

instance Data.ToJSON UpgradeDomain where
  toJSON :: UpgradeDomain -> Value
toJSON UpgradeDomain' {Maybe Bool
Maybe (HashMap Text Text)
Text
targetVersion :: Text
domainName :: Text
performCheckOnly :: Maybe Bool
advancedOptions :: Maybe (HashMap Text Text)
$sel:targetVersion:UpgradeDomain' :: UpgradeDomain -> Text
$sel:domainName:UpgradeDomain' :: UpgradeDomain -> Text
$sel:performCheckOnly:UpgradeDomain' :: UpgradeDomain -> Maybe Bool
$sel:advancedOptions:UpgradeDomain' :: UpgradeDomain -> Maybe (HashMap Text Text)
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"AdvancedOptions" 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 (HashMap Text Text)
advancedOptions,
            (Key
"PerformCheckOnly" 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 Bool
performCheckOnly,
            forall a. a -> Maybe a
Prelude.Just (Key
"DomainName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
domainName),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"TargetVersion" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
targetVersion)
          ]
      )

instance Data.ToPath UpgradeDomain where
  toPath :: UpgradeDomain -> ByteString
toPath =
    forall a b. a -> b -> a
Prelude.const
      ByteString
"/2021-01-01/opensearch/upgradeDomain"

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

-- | Container for the response returned by @UpgradeDomain@ operation.
--
-- /See:/ 'newUpgradeDomainResponse' smart constructor.
data UpgradeDomainResponse = UpgradeDomainResponse'
  { -- | The advanced options configuration for the domain.
    UpgradeDomainResponse -> Maybe (HashMap Text Text)
advancedOptions :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | Container for information about a configuration change happening on a
    -- domain.
    UpgradeDomainResponse -> Maybe ChangeProgressDetails
changeProgressDetails :: Prelude.Maybe ChangeProgressDetails,
    -- | The name of the domain that was upgraded.
    UpgradeDomainResponse -> Maybe Text
domainName :: Prelude.Maybe Prelude.Text,
    -- | When true, indicates that an upgrade eligibility check was performed.
    UpgradeDomainResponse -> Maybe Bool
performCheckOnly :: Prelude.Maybe Prelude.Bool,
    -- | OpenSearch or Elasticsearch version that the domain was upgraded to.
    UpgradeDomainResponse -> Maybe Text
targetVersion :: Prelude.Maybe Prelude.Text,
    -- | The unique identifier of the domain upgrade.
    UpgradeDomainResponse -> Maybe Text
upgradeId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    UpgradeDomainResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (UpgradeDomainResponse -> UpgradeDomainResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpgradeDomainResponse -> UpgradeDomainResponse -> Bool
$c/= :: UpgradeDomainResponse -> UpgradeDomainResponse -> Bool
== :: UpgradeDomainResponse -> UpgradeDomainResponse -> Bool
$c== :: UpgradeDomainResponse -> UpgradeDomainResponse -> Bool
Prelude.Eq, ReadPrec [UpgradeDomainResponse]
ReadPrec UpgradeDomainResponse
Int -> ReadS UpgradeDomainResponse
ReadS [UpgradeDomainResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpgradeDomainResponse]
$creadListPrec :: ReadPrec [UpgradeDomainResponse]
readPrec :: ReadPrec UpgradeDomainResponse
$creadPrec :: ReadPrec UpgradeDomainResponse
readList :: ReadS [UpgradeDomainResponse]
$creadList :: ReadS [UpgradeDomainResponse]
readsPrec :: Int -> ReadS UpgradeDomainResponse
$creadsPrec :: Int -> ReadS UpgradeDomainResponse
Prelude.Read, Int -> UpgradeDomainResponse -> ShowS
[UpgradeDomainResponse] -> ShowS
UpgradeDomainResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpgradeDomainResponse] -> ShowS
$cshowList :: [UpgradeDomainResponse] -> ShowS
show :: UpgradeDomainResponse -> String
$cshow :: UpgradeDomainResponse -> String
showsPrec :: Int -> UpgradeDomainResponse -> ShowS
$cshowsPrec :: Int -> UpgradeDomainResponse -> ShowS
Prelude.Show, forall x. Rep UpgradeDomainResponse x -> UpgradeDomainResponse
forall x. UpgradeDomainResponse -> Rep UpgradeDomainResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpgradeDomainResponse x -> UpgradeDomainResponse
$cfrom :: forall x. UpgradeDomainResponse -> Rep UpgradeDomainResponse x
Prelude.Generic)

-- |
-- Create a value of 'UpgradeDomainResponse' 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:
--
-- 'advancedOptions', 'upgradeDomainResponse_advancedOptions' - The advanced options configuration for the domain.
--
-- 'changeProgressDetails', 'upgradeDomainResponse_changeProgressDetails' - Container for information about a configuration change happening on a
-- domain.
--
-- 'domainName', 'upgradeDomainResponse_domainName' - The name of the domain that was upgraded.
--
-- 'performCheckOnly', 'upgradeDomainResponse_performCheckOnly' - When true, indicates that an upgrade eligibility check was performed.
--
-- 'targetVersion', 'upgradeDomainResponse_targetVersion' - OpenSearch or Elasticsearch version that the domain was upgraded to.
--
-- 'upgradeId', 'upgradeDomainResponse_upgradeId' - The unique identifier of the domain upgrade.
--
-- 'httpStatus', 'upgradeDomainResponse_httpStatus' - The response's http status code.
newUpgradeDomainResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  UpgradeDomainResponse
newUpgradeDomainResponse :: Int -> UpgradeDomainResponse
newUpgradeDomainResponse Int
pHttpStatus_ =
  UpgradeDomainResponse'
    { $sel:advancedOptions:UpgradeDomainResponse' :: Maybe (HashMap Text Text)
advancedOptions =
        forall a. Maybe a
Prelude.Nothing,
      $sel:changeProgressDetails:UpgradeDomainResponse' :: Maybe ChangeProgressDetails
changeProgressDetails = forall a. Maybe a
Prelude.Nothing,
      $sel:domainName:UpgradeDomainResponse' :: Maybe Text
domainName = forall a. Maybe a
Prelude.Nothing,
      $sel:performCheckOnly:UpgradeDomainResponse' :: Maybe Bool
performCheckOnly = forall a. Maybe a
Prelude.Nothing,
      $sel:targetVersion:UpgradeDomainResponse' :: Maybe Text
targetVersion = forall a. Maybe a
Prelude.Nothing,
      $sel:upgradeId:UpgradeDomainResponse' :: Maybe Text
upgradeId = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:UpgradeDomainResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The advanced options configuration for the domain.
upgradeDomainResponse_advancedOptions :: Lens.Lens' UpgradeDomainResponse (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
upgradeDomainResponse_advancedOptions :: Lens' UpgradeDomainResponse (Maybe (HashMap Text Text))
upgradeDomainResponse_advancedOptions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpgradeDomainResponse' {Maybe (HashMap Text Text)
advancedOptions :: Maybe (HashMap Text Text)
$sel:advancedOptions:UpgradeDomainResponse' :: UpgradeDomainResponse -> Maybe (HashMap Text Text)
advancedOptions} -> Maybe (HashMap Text Text)
advancedOptions) (\s :: UpgradeDomainResponse
s@UpgradeDomainResponse' {} Maybe (HashMap Text Text)
a -> UpgradeDomainResponse
s {$sel:advancedOptions:UpgradeDomainResponse' :: Maybe (HashMap Text Text)
advancedOptions = Maybe (HashMap Text Text)
a} :: UpgradeDomainResponse) 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

-- | Container for information about a configuration change happening on a
-- domain.
upgradeDomainResponse_changeProgressDetails :: Lens.Lens' UpgradeDomainResponse (Prelude.Maybe ChangeProgressDetails)
upgradeDomainResponse_changeProgressDetails :: Lens' UpgradeDomainResponse (Maybe ChangeProgressDetails)
upgradeDomainResponse_changeProgressDetails = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpgradeDomainResponse' {Maybe ChangeProgressDetails
changeProgressDetails :: Maybe ChangeProgressDetails
$sel:changeProgressDetails:UpgradeDomainResponse' :: UpgradeDomainResponse -> Maybe ChangeProgressDetails
changeProgressDetails} -> Maybe ChangeProgressDetails
changeProgressDetails) (\s :: UpgradeDomainResponse
s@UpgradeDomainResponse' {} Maybe ChangeProgressDetails
a -> UpgradeDomainResponse
s {$sel:changeProgressDetails:UpgradeDomainResponse' :: Maybe ChangeProgressDetails
changeProgressDetails = Maybe ChangeProgressDetails
a} :: UpgradeDomainResponse)

-- | The name of the domain that was upgraded.
upgradeDomainResponse_domainName :: Lens.Lens' UpgradeDomainResponse (Prelude.Maybe Prelude.Text)
upgradeDomainResponse_domainName :: Lens' UpgradeDomainResponse (Maybe Text)
upgradeDomainResponse_domainName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpgradeDomainResponse' {Maybe Text
domainName :: Maybe Text
$sel:domainName:UpgradeDomainResponse' :: UpgradeDomainResponse -> Maybe Text
domainName} -> Maybe Text
domainName) (\s :: UpgradeDomainResponse
s@UpgradeDomainResponse' {} Maybe Text
a -> UpgradeDomainResponse
s {$sel:domainName:UpgradeDomainResponse' :: Maybe Text
domainName = Maybe Text
a} :: UpgradeDomainResponse)

-- | When true, indicates that an upgrade eligibility check was performed.
upgradeDomainResponse_performCheckOnly :: Lens.Lens' UpgradeDomainResponse (Prelude.Maybe Prelude.Bool)
upgradeDomainResponse_performCheckOnly :: Lens' UpgradeDomainResponse (Maybe Bool)
upgradeDomainResponse_performCheckOnly = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpgradeDomainResponse' {Maybe Bool
performCheckOnly :: Maybe Bool
$sel:performCheckOnly:UpgradeDomainResponse' :: UpgradeDomainResponse -> Maybe Bool
performCheckOnly} -> Maybe Bool
performCheckOnly) (\s :: UpgradeDomainResponse
s@UpgradeDomainResponse' {} Maybe Bool
a -> UpgradeDomainResponse
s {$sel:performCheckOnly:UpgradeDomainResponse' :: Maybe Bool
performCheckOnly = Maybe Bool
a} :: UpgradeDomainResponse)

-- | OpenSearch or Elasticsearch version that the domain was upgraded to.
upgradeDomainResponse_targetVersion :: Lens.Lens' UpgradeDomainResponse (Prelude.Maybe Prelude.Text)
upgradeDomainResponse_targetVersion :: Lens' UpgradeDomainResponse (Maybe Text)
upgradeDomainResponse_targetVersion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpgradeDomainResponse' {Maybe Text
targetVersion :: Maybe Text
$sel:targetVersion:UpgradeDomainResponse' :: UpgradeDomainResponse -> Maybe Text
targetVersion} -> Maybe Text
targetVersion) (\s :: UpgradeDomainResponse
s@UpgradeDomainResponse' {} Maybe Text
a -> UpgradeDomainResponse
s {$sel:targetVersion:UpgradeDomainResponse' :: Maybe Text
targetVersion = Maybe Text
a} :: UpgradeDomainResponse)

-- | The unique identifier of the domain upgrade.
upgradeDomainResponse_upgradeId :: Lens.Lens' UpgradeDomainResponse (Prelude.Maybe Prelude.Text)
upgradeDomainResponse_upgradeId :: Lens' UpgradeDomainResponse (Maybe Text)
upgradeDomainResponse_upgradeId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpgradeDomainResponse' {Maybe Text
upgradeId :: Maybe Text
$sel:upgradeId:UpgradeDomainResponse' :: UpgradeDomainResponse -> Maybe Text
upgradeId} -> Maybe Text
upgradeId) (\s :: UpgradeDomainResponse
s@UpgradeDomainResponse' {} Maybe Text
a -> UpgradeDomainResponse
s {$sel:upgradeId:UpgradeDomainResponse' :: Maybe Text
upgradeId = Maybe Text
a} :: UpgradeDomainResponse)

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

instance Prelude.NFData UpgradeDomainResponse where
  rnf :: UpgradeDomainResponse -> ()
rnf UpgradeDomainResponse' {Int
Maybe Bool
Maybe Text
Maybe (HashMap Text Text)
Maybe ChangeProgressDetails
httpStatus :: Int
upgradeId :: Maybe Text
targetVersion :: Maybe Text
performCheckOnly :: Maybe Bool
domainName :: Maybe Text
changeProgressDetails :: Maybe ChangeProgressDetails
advancedOptions :: Maybe (HashMap Text Text)
$sel:httpStatus:UpgradeDomainResponse' :: UpgradeDomainResponse -> Int
$sel:upgradeId:UpgradeDomainResponse' :: UpgradeDomainResponse -> Maybe Text
$sel:targetVersion:UpgradeDomainResponse' :: UpgradeDomainResponse -> Maybe Text
$sel:performCheckOnly:UpgradeDomainResponse' :: UpgradeDomainResponse -> Maybe Bool
$sel:domainName:UpgradeDomainResponse' :: UpgradeDomainResponse -> Maybe Text
$sel:changeProgressDetails:UpgradeDomainResponse' :: UpgradeDomainResponse -> Maybe ChangeProgressDetails
$sel:advancedOptions:UpgradeDomainResponse' :: UpgradeDomainResponse -> Maybe (HashMap Text Text)
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
advancedOptions
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ChangeProgressDetails
changeProgressDetails
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
domainName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
performCheckOnly
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
targetVersion
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
upgradeId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus