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

    -- * Request Lenses
    revokeDomainAccess_fleetArn,
    revokeDomainAccess_domainName,

    -- * Destructuring the Response
    RevokeDomainAccessResponse (..),
    newRevokeDomainAccessResponse,

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

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

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

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

instance Core.AWSRequest RevokeDomainAccess where
  type
    AWSResponse RevokeDomainAccess =
      RevokeDomainAccessResponse
  request :: RevokeDomainAccess -> Request RevokeDomainAccess
request = Service -> RevokeDomainAccess -> Request RevokeDomainAccess
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy RevokeDomainAccess
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse RevokeDomainAccess)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse RevokeDomainAccess))
-> Logger
-> Service
-> Proxy RevokeDomainAccess
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse RevokeDomainAccess)))
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 -> RevokeDomainAccessResponse
RevokeDomainAccessResponse'
            (Int -> RevokeDomainAccessResponse)
-> Either String Int -> Either String RevokeDomainAccessResponse
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 RevokeDomainAccess

instance Prelude.NFData RevokeDomainAccess

instance Core.ToHeaders RevokeDomainAccess where
  toHeaders :: RevokeDomainAccess -> ResponseHeaders
toHeaders =
    ResponseHeaders -> RevokeDomainAccess -> 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 RevokeDomainAccess where
  toJSON :: RevokeDomainAccess -> Value
toJSON RevokeDomainAccess' {Text
domainName :: Text
fleetArn :: Text
$sel:domainName:RevokeDomainAccess' :: RevokeDomainAccess -> Text
$sel:fleetArn:RevokeDomainAccess' :: RevokeDomainAccess -> 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 RevokeDomainAccess where
  toPath :: RevokeDomainAccess -> ByteString
toPath = ByteString -> RevokeDomainAccess -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/revokeDomainAccess"

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

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

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

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

instance Prelude.NFData RevokeDomainAccessResponse