{-# 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.WorkLink.RestoreDomainAccess
-- 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)
--
-- Moves a domain to ACTIVE status if it was in the INACTIVE status.
module Amazonka.WorkLink.RestoreDomainAccess
  ( -- * Creating a Request
    RestoreDomainAccess (..),
    newRestoreDomainAccess,

    -- * Request Lenses
    restoreDomainAccess_fleetArn,
    restoreDomainAccess_domainName,

    -- * Destructuring the Response
    RestoreDomainAccessResponse (..),
    newRestoreDomainAccessResponse,

    -- * Response Lenses
    restoreDomainAccessResponse_httpStatus,
  )
where

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

-- | /See:/ 'newRestoreDomainAccess' smart constructor.
data RestoreDomainAccess = RestoreDomainAccess'
  { -- | The ARN of the fleet.
    RestoreDomainAccess -> Text
fleetArn :: Prelude.Text,
    -- | The name of the domain.
    RestoreDomainAccess -> Text
domainName :: Prelude.Text
  }
  deriving (RestoreDomainAccess -> RestoreDomainAccess -> Bool
(RestoreDomainAccess -> RestoreDomainAccess -> Bool)
-> (RestoreDomainAccess -> RestoreDomainAccess -> Bool)
-> Eq RestoreDomainAccess
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RestoreDomainAccess -> RestoreDomainAccess -> Bool
$c/= :: RestoreDomainAccess -> RestoreDomainAccess -> Bool
== :: RestoreDomainAccess -> RestoreDomainAccess -> Bool
$c== :: RestoreDomainAccess -> RestoreDomainAccess -> Bool
Prelude.Eq, ReadPrec [RestoreDomainAccess]
ReadPrec RestoreDomainAccess
Int -> ReadS RestoreDomainAccess
ReadS [RestoreDomainAccess]
(Int -> ReadS RestoreDomainAccess)
-> ReadS [RestoreDomainAccess]
-> ReadPrec RestoreDomainAccess
-> ReadPrec [RestoreDomainAccess]
-> Read RestoreDomainAccess
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RestoreDomainAccess]
$creadListPrec :: ReadPrec [RestoreDomainAccess]
readPrec :: ReadPrec RestoreDomainAccess
$creadPrec :: ReadPrec RestoreDomainAccess
readList :: ReadS [RestoreDomainAccess]
$creadList :: ReadS [RestoreDomainAccess]
readsPrec :: Int -> ReadS RestoreDomainAccess
$creadsPrec :: Int -> ReadS RestoreDomainAccess
Prelude.Read, Int -> RestoreDomainAccess -> ShowS
[RestoreDomainAccess] -> ShowS
RestoreDomainAccess -> String
(Int -> RestoreDomainAccess -> ShowS)
-> (RestoreDomainAccess -> String)
-> ([RestoreDomainAccess] -> ShowS)
-> Show RestoreDomainAccess
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RestoreDomainAccess] -> ShowS
$cshowList :: [RestoreDomainAccess] -> ShowS
show :: RestoreDomainAccess -> String
$cshow :: RestoreDomainAccess -> String
showsPrec :: Int -> RestoreDomainAccess -> ShowS
$cshowsPrec :: Int -> RestoreDomainAccess -> ShowS
Prelude.Show, (forall x. RestoreDomainAccess -> Rep RestoreDomainAccess x)
-> (forall x. Rep RestoreDomainAccess x -> RestoreDomainAccess)
-> Generic RestoreDomainAccess
forall x. Rep RestoreDomainAccess x -> RestoreDomainAccess
forall x. RestoreDomainAccess -> Rep RestoreDomainAccess x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RestoreDomainAccess x -> RestoreDomainAccess
$cfrom :: forall x. RestoreDomainAccess -> Rep RestoreDomainAccess x
Prelude.Generic)

-- |
-- Create a value of 'RestoreDomainAccess' 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:
--
-- 'fleetArn', 'restoreDomainAccess_fleetArn' - The ARN of the fleet.
--
-- 'domainName', 'restoreDomainAccess_domainName' - The name of the domain.
newRestoreDomainAccess ::
  -- | 'fleetArn'
  Prelude.Text ->
  -- | 'domainName'
  Prelude.Text ->
  RestoreDomainAccess
newRestoreDomainAccess :: Text -> Text -> RestoreDomainAccess
newRestoreDomainAccess Text
pFleetArn_ Text
pDomainName_ =
  RestoreDomainAccess' :: Text -> Text -> RestoreDomainAccess
RestoreDomainAccess'
    { $sel:fleetArn:RestoreDomainAccess' :: Text
fleetArn = Text
pFleetArn_,
      $sel:domainName:RestoreDomainAccess' :: Text
domainName = Text
pDomainName_
    }

-- | The ARN of the fleet.
restoreDomainAccess_fleetArn :: Lens.Lens' RestoreDomainAccess Prelude.Text
restoreDomainAccess_fleetArn :: (Text -> f Text) -> RestoreDomainAccess -> f RestoreDomainAccess
restoreDomainAccess_fleetArn = (RestoreDomainAccess -> Text)
-> (RestoreDomainAccess -> Text -> RestoreDomainAccess)
-> Lens RestoreDomainAccess RestoreDomainAccess Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RestoreDomainAccess' {Text
fleetArn :: Text
$sel:fleetArn:RestoreDomainAccess' :: RestoreDomainAccess -> Text
fleetArn} -> Text
fleetArn) (\s :: RestoreDomainAccess
s@RestoreDomainAccess' {} Text
a -> RestoreDomainAccess
s {$sel:fleetArn:RestoreDomainAccess' :: Text
fleetArn = Text
a} :: RestoreDomainAccess)

-- | The name of the domain.
restoreDomainAccess_domainName :: Lens.Lens' RestoreDomainAccess Prelude.Text
restoreDomainAccess_domainName :: (Text -> f Text) -> RestoreDomainAccess -> f RestoreDomainAccess
restoreDomainAccess_domainName = (RestoreDomainAccess -> Text)
-> (RestoreDomainAccess -> Text -> RestoreDomainAccess)
-> Lens RestoreDomainAccess RestoreDomainAccess Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RestoreDomainAccess' {Text
domainName :: Text
$sel:domainName:RestoreDomainAccess' :: RestoreDomainAccess -> Text
domainName} -> Text
domainName) (\s :: RestoreDomainAccess
s@RestoreDomainAccess' {} Text
a -> RestoreDomainAccess
s {$sel:domainName:RestoreDomainAccess' :: Text
domainName = Text
a} :: RestoreDomainAccess)

instance Core.AWSRequest RestoreDomainAccess where
  type
    AWSResponse RestoreDomainAccess =
      RestoreDomainAccessResponse
  request :: RestoreDomainAccess -> Request RestoreDomainAccess
request = Service -> RestoreDomainAccess -> Request RestoreDomainAccess
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy RestoreDomainAccess
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse RestoreDomainAccess)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse RestoreDomainAccess))
-> Logger
-> Service
-> Proxy RestoreDomainAccess
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse RestoreDomainAccess)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> RestoreDomainAccessResponse
RestoreDomainAccessResponse'
            (Int -> RestoreDomainAccessResponse)
-> Either String Int -> Either String RestoreDomainAccessResponse
forall (f :: * -> *) a b. Functor 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 RestoreDomainAccess

instance Prelude.NFData RestoreDomainAccess

instance Core.ToHeaders RestoreDomainAccess where
  toHeaders :: RestoreDomainAccess -> ResponseHeaders
toHeaders =
    ResponseHeaders -> RestoreDomainAccess -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ 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 RestoreDomainAccess where
  toJSON :: RestoreDomainAccess -> Value
toJSON RestoreDomainAccess' {Text
domainName :: Text
fleetArn :: Text
$sel:domainName:RestoreDomainAccess' :: RestoreDomainAccess -> Text
$sel:fleetArn:RestoreDomainAccess' :: RestoreDomainAccess -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"FleetArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
fleetArn),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"DomainName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
domainName)
          ]
      )

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

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

-- | /See:/ 'newRestoreDomainAccessResponse' smart constructor.
data RestoreDomainAccessResponse = RestoreDomainAccessResponse'
  { -- | The response's http status code.
    RestoreDomainAccessResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (RestoreDomainAccessResponse -> RestoreDomainAccessResponse -> Bool
(RestoreDomainAccessResponse
 -> RestoreDomainAccessResponse -> Bool)
-> (RestoreDomainAccessResponse
    -> RestoreDomainAccessResponse -> Bool)
-> Eq RestoreDomainAccessResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RestoreDomainAccessResponse -> RestoreDomainAccessResponse -> Bool
$c/= :: RestoreDomainAccessResponse -> RestoreDomainAccessResponse -> Bool
== :: RestoreDomainAccessResponse -> RestoreDomainAccessResponse -> Bool
$c== :: RestoreDomainAccessResponse -> RestoreDomainAccessResponse -> Bool
Prelude.Eq, ReadPrec [RestoreDomainAccessResponse]
ReadPrec RestoreDomainAccessResponse
Int -> ReadS RestoreDomainAccessResponse
ReadS [RestoreDomainAccessResponse]
(Int -> ReadS RestoreDomainAccessResponse)
-> ReadS [RestoreDomainAccessResponse]
-> ReadPrec RestoreDomainAccessResponse
-> ReadPrec [RestoreDomainAccessResponse]
-> Read RestoreDomainAccessResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RestoreDomainAccessResponse]
$creadListPrec :: ReadPrec [RestoreDomainAccessResponse]
readPrec :: ReadPrec RestoreDomainAccessResponse
$creadPrec :: ReadPrec RestoreDomainAccessResponse
readList :: ReadS [RestoreDomainAccessResponse]
$creadList :: ReadS [RestoreDomainAccessResponse]
readsPrec :: Int -> ReadS RestoreDomainAccessResponse
$creadsPrec :: Int -> ReadS RestoreDomainAccessResponse
Prelude.Read, Int -> RestoreDomainAccessResponse -> ShowS
[RestoreDomainAccessResponse] -> ShowS
RestoreDomainAccessResponse -> String
(Int -> RestoreDomainAccessResponse -> ShowS)
-> (RestoreDomainAccessResponse -> String)
-> ([RestoreDomainAccessResponse] -> ShowS)
-> Show RestoreDomainAccessResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RestoreDomainAccessResponse] -> ShowS
$cshowList :: [RestoreDomainAccessResponse] -> ShowS
show :: RestoreDomainAccessResponse -> String
$cshow :: RestoreDomainAccessResponse -> String
showsPrec :: Int -> RestoreDomainAccessResponse -> ShowS
$cshowsPrec :: Int -> RestoreDomainAccessResponse -> ShowS
Prelude.Show, (forall x.
 RestoreDomainAccessResponse -> Rep RestoreDomainAccessResponse x)
-> (forall x.
    Rep RestoreDomainAccessResponse x -> RestoreDomainAccessResponse)
-> Generic RestoreDomainAccessResponse
forall x.
Rep RestoreDomainAccessResponse x -> RestoreDomainAccessResponse
forall x.
RestoreDomainAccessResponse -> Rep RestoreDomainAccessResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RestoreDomainAccessResponse x -> RestoreDomainAccessResponse
$cfrom :: forall x.
RestoreDomainAccessResponse -> Rep RestoreDomainAccessResponse x
Prelude.Generic)

-- |
-- Create a value of 'RestoreDomainAccessResponse' 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:
--
-- 'httpStatus', 'restoreDomainAccessResponse_httpStatus' - The response's http status code.
newRestoreDomainAccessResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  RestoreDomainAccessResponse
newRestoreDomainAccessResponse :: Int -> RestoreDomainAccessResponse
newRestoreDomainAccessResponse Int
pHttpStatus_ =
  RestoreDomainAccessResponse' :: Int -> RestoreDomainAccessResponse
RestoreDomainAccessResponse'
    { $sel:httpStatus:RestoreDomainAccessResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

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

instance Prelude.NFData RestoreDomainAccessResponse