{-# 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.DeviceFarm.DeleteInstanceProfile
-- 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)
--
-- Deletes a profile that can be applied to one or more private device
-- instances.
module Amazonka.DeviceFarm.DeleteInstanceProfile
  ( -- * Creating a Request
    DeleteInstanceProfile (..),
    newDeleteInstanceProfile,

    -- * Request Lenses
    deleteInstanceProfile_arn,

    -- * Destructuring the Response
    DeleteInstanceProfileResponse (..),
    newDeleteInstanceProfileResponse,

    -- * Response Lenses
    deleteInstanceProfileResponse_httpStatus,
  )
where

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

-- | /See:/ 'newDeleteInstanceProfile' smart constructor.
data DeleteInstanceProfile = DeleteInstanceProfile'
  { -- | The Amazon Resource Name (ARN) of the instance profile you are
    -- requesting to delete.
    DeleteInstanceProfile -> Text
arn :: Prelude.Text
  }
  deriving (DeleteInstanceProfile -> DeleteInstanceProfile -> Bool
(DeleteInstanceProfile -> DeleteInstanceProfile -> Bool)
-> (DeleteInstanceProfile -> DeleteInstanceProfile -> Bool)
-> Eq DeleteInstanceProfile
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteInstanceProfile -> DeleteInstanceProfile -> Bool
$c/= :: DeleteInstanceProfile -> DeleteInstanceProfile -> Bool
== :: DeleteInstanceProfile -> DeleteInstanceProfile -> Bool
$c== :: DeleteInstanceProfile -> DeleteInstanceProfile -> Bool
Prelude.Eq, ReadPrec [DeleteInstanceProfile]
ReadPrec DeleteInstanceProfile
Int -> ReadS DeleteInstanceProfile
ReadS [DeleteInstanceProfile]
(Int -> ReadS DeleteInstanceProfile)
-> ReadS [DeleteInstanceProfile]
-> ReadPrec DeleteInstanceProfile
-> ReadPrec [DeleteInstanceProfile]
-> Read DeleteInstanceProfile
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteInstanceProfile]
$creadListPrec :: ReadPrec [DeleteInstanceProfile]
readPrec :: ReadPrec DeleteInstanceProfile
$creadPrec :: ReadPrec DeleteInstanceProfile
readList :: ReadS [DeleteInstanceProfile]
$creadList :: ReadS [DeleteInstanceProfile]
readsPrec :: Int -> ReadS DeleteInstanceProfile
$creadsPrec :: Int -> ReadS DeleteInstanceProfile
Prelude.Read, Int -> DeleteInstanceProfile -> ShowS
[DeleteInstanceProfile] -> ShowS
DeleteInstanceProfile -> String
(Int -> DeleteInstanceProfile -> ShowS)
-> (DeleteInstanceProfile -> String)
-> ([DeleteInstanceProfile] -> ShowS)
-> Show DeleteInstanceProfile
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteInstanceProfile] -> ShowS
$cshowList :: [DeleteInstanceProfile] -> ShowS
show :: DeleteInstanceProfile -> String
$cshow :: DeleteInstanceProfile -> String
showsPrec :: Int -> DeleteInstanceProfile -> ShowS
$cshowsPrec :: Int -> DeleteInstanceProfile -> ShowS
Prelude.Show, (forall x. DeleteInstanceProfile -> Rep DeleteInstanceProfile x)
-> (forall x. Rep DeleteInstanceProfile x -> DeleteInstanceProfile)
-> Generic DeleteInstanceProfile
forall x. Rep DeleteInstanceProfile x -> DeleteInstanceProfile
forall x. DeleteInstanceProfile -> Rep DeleteInstanceProfile x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteInstanceProfile x -> DeleteInstanceProfile
$cfrom :: forall x. DeleteInstanceProfile -> Rep DeleteInstanceProfile x
Prelude.Generic)

-- |
-- Create a value of 'DeleteInstanceProfile' 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:
--
-- 'arn', 'deleteInstanceProfile_arn' - The Amazon Resource Name (ARN) of the instance profile you are
-- requesting to delete.
newDeleteInstanceProfile ::
  -- | 'arn'
  Prelude.Text ->
  DeleteInstanceProfile
newDeleteInstanceProfile :: Text -> DeleteInstanceProfile
newDeleteInstanceProfile Text
pArn_ =
  DeleteInstanceProfile' :: Text -> DeleteInstanceProfile
DeleteInstanceProfile' {$sel:arn:DeleteInstanceProfile' :: Text
arn = Text
pArn_}

-- | The Amazon Resource Name (ARN) of the instance profile you are
-- requesting to delete.
deleteInstanceProfile_arn :: Lens.Lens' DeleteInstanceProfile Prelude.Text
deleteInstanceProfile_arn :: (Text -> f Text)
-> DeleteInstanceProfile -> f DeleteInstanceProfile
deleteInstanceProfile_arn = (DeleteInstanceProfile -> Text)
-> (DeleteInstanceProfile -> Text -> DeleteInstanceProfile)
-> Lens DeleteInstanceProfile DeleteInstanceProfile Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteInstanceProfile' {Text
arn :: Text
$sel:arn:DeleteInstanceProfile' :: DeleteInstanceProfile -> Text
arn} -> Text
arn) (\s :: DeleteInstanceProfile
s@DeleteInstanceProfile' {} Text
a -> DeleteInstanceProfile
s {$sel:arn:DeleteInstanceProfile' :: Text
arn = Text
a} :: DeleteInstanceProfile)

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

instance Prelude.NFData DeleteInstanceProfile

instance Core.ToHeaders DeleteInstanceProfile where
  toHeaders :: DeleteInstanceProfile -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteInstanceProfile -> 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
"DeviceFarm_20150623.DeleteInstanceProfile" ::
                          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 DeleteInstanceProfile where
  toJSON :: DeleteInstanceProfile -> Value
toJSON DeleteInstanceProfile' {Text
arn :: Text
$sel:arn:DeleteInstanceProfile' :: DeleteInstanceProfile -> 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
"arn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
arn)]
      )

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

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

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

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

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

instance Prelude.NFData DeleteInstanceProfileResponse