{-# 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.CodeDeploy.RemoveTagsFromOnPremisesInstances
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Removes one or more tags from one or more on-premises instances.
module Amazonka.CodeDeploy.RemoveTagsFromOnPremisesInstances
  ( -- * Creating a Request
    RemoveTagsFromOnPremisesInstances (..),
    newRemoveTagsFromOnPremisesInstances,

    -- * Request Lenses
    removeTagsFromOnPremisesInstances_tags,
    removeTagsFromOnPremisesInstances_instanceNames,

    -- * Destructuring the Response
    RemoveTagsFromOnPremisesInstancesResponse (..),
    newRemoveTagsFromOnPremisesInstancesResponse,
  )
where

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

-- | Represents the input of a @RemoveTagsFromOnPremisesInstances@ operation.
--
-- /See:/ 'newRemoveTagsFromOnPremisesInstances' smart constructor.
data RemoveTagsFromOnPremisesInstances = RemoveTagsFromOnPremisesInstances'
  { -- | The tag key-value pairs to remove from the on-premises instances.
    RemoveTagsFromOnPremisesInstances -> [Tag]
tags :: [Tag],
    -- | The names of the on-premises instances from which to remove tags.
    RemoveTagsFromOnPremisesInstances -> [Text]
instanceNames :: [Prelude.Text]
  }
  deriving (RemoveTagsFromOnPremisesInstances
-> RemoveTagsFromOnPremisesInstances -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RemoveTagsFromOnPremisesInstances
-> RemoveTagsFromOnPremisesInstances -> Bool
$c/= :: RemoveTagsFromOnPremisesInstances
-> RemoveTagsFromOnPremisesInstances -> Bool
== :: RemoveTagsFromOnPremisesInstances
-> RemoveTagsFromOnPremisesInstances -> Bool
$c== :: RemoveTagsFromOnPremisesInstances
-> RemoveTagsFromOnPremisesInstances -> Bool
Prelude.Eq, ReadPrec [RemoveTagsFromOnPremisesInstances]
ReadPrec RemoveTagsFromOnPremisesInstances
Int -> ReadS RemoveTagsFromOnPremisesInstances
ReadS [RemoveTagsFromOnPremisesInstances]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RemoveTagsFromOnPremisesInstances]
$creadListPrec :: ReadPrec [RemoveTagsFromOnPremisesInstances]
readPrec :: ReadPrec RemoveTagsFromOnPremisesInstances
$creadPrec :: ReadPrec RemoveTagsFromOnPremisesInstances
readList :: ReadS [RemoveTagsFromOnPremisesInstances]
$creadList :: ReadS [RemoveTagsFromOnPremisesInstances]
readsPrec :: Int -> ReadS RemoveTagsFromOnPremisesInstances
$creadsPrec :: Int -> ReadS RemoveTagsFromOnPremisesInstances
Prelude.Read, Int -> RemoveTagsFromOnPremisesInstances -> ShowS
[RemoveTagsFromOnPremisesInstances] -> ShowS
RemoveTagsFromOnPremisesInstances -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RemoveTagsFromOnPremisesInstances] -> ShowS
$cshowList :: [RemoveTagsFromOnPremisesInstances] -> ShowS
show :: RemoveTagsFromOnPremisesInstances -> String
$cshow :: RemoveTagsFromOnPremisesInstances -> String
showsPrec :: Int -> RemoveTagsFromOnPremisesInstances -> ShowS
$cshowsPrec :: Int -> RemoveTagsFromOnPremisesInstances -> ShowS
Prelude.Show, forall x.
Rep RemoveTagsFromOnPremisesInstances x
-> RemoveTagsFromOnPremisesInstances
forall x.
RemoveTagsFromOnPremisesInstances
-> Rep RemoveTagsFromOnPremisesInstances x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RemoveTagsFromOnPremisesInstances x
-> RemoveTagsFromOnPremisesInstances
$cfrom :: forall x.
RemoveTagsFromOnPremisesInstances
-> Rep RemoveTagsFromOnPremisesInstances x
Prelude.Generic)

-- |
-- Create a value of 'RemoveTagsFromOnPremisesInstances' 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:
--
-- 'tags', 'removeTagsFromOnPremisesInstances_tags' - The tag key-value pairs to remove from the on-premises instances.
--
-- 'instanceNames', 'removeTagsFromOnPremisesInstances_instanceNames' - The names of the on-premises instances from which to remove tags.
newRemoveTagsFromOnPremisesInstances ::
  RemoveTagsFromOnPremisesInstances
newRemoveTagsFromOnPremisesInstances :: RemoveTagsFromOnPremisesInstances
newRemoveTagsFromOnPremisesInstances =
  RemoveTagsFromOnPremisesInstances'
    { $sel:tags:RemoveTagsFromOnPremisesInstances' :: [Tag]
tags =
        forall a. Monoid a => a
Prelude.mempty,
      $sel:instanceNames:RemoveTagsFromOnPremisesInstances' :: [Text]
instanceNames = forall a. Monoid a => a
Prelude.mempty
    }

-- | The tag key-value pairs to remove from the on-premises instances.
removeTagsFromOnPremisesInstances_tags :: Lens.Lens' RemoveTagsFromOnPremisesInstances [Tag]
removeTagsFromOnPremisesInstances_tags :: Lens' RemoveTagsFromOnPremisesInstances [Tag]
removeTagsFromOnPremisesInstances_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemoveTagsFromOnPremisesInstances' {[Tag]
tags :: [Tag]
$sel:tags:RemoveTagsFromOnPremisesInstances' :: RemoveTagsFromOnPremisesInstances -> [Tag]
tags} -> [Tag]
tags) (\s :: RemoveTagsFromOnPremisesInstances
s@RemoveTagsFromOnPremisesInstances' {} [Tag]
a -> RemoveTagsFromOnPremisesInstances
s {$sel:tags:RemoveTagsFromOnPremisesInstances' :: [Tag]
tags = [Tag]
a} :: RemoveTagsFromOnPremisesInstances) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The names of the on-premises instances from which to remove tags.
removeTagsFromOnPremisesInstances_instanceNames :: Lens.Lens' RemoveTagsFromOnPremisesInstances [Prelude.Text]
removeTagsFromOnPremisesInstances_instanceNames :: Lens' RemoveTagsFromOnPremisesInstances [Text]
removeTagsFromOnPremisesInstances_instanceNames = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemoveTagsFromOnPremisesInstances' {[Text]
instanceNames :: [Text]
$sel:instanceNames:RemoveTagsFromOnPremisesInstances' :: RemoveTagsFromOnPremisesInstances -> [Text]
instanceNames} -> [Text]
instanceNames) (\s :: RemoveTagsFromOnPremisesInstances
s@RemoveTagsFromOnPremisesInstances' {} [Text]
a -> RemoveTagsFromOnPremisesInstances
s {$sel:instanceNames:RemoveTagsFromOnPremisesInstances' :: [Text]
instanceNames = [Text]
a} :: RemoveTagsFromOnPremisesInstances) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance
  Core.AWSRequest
    RemoveTagsFromOnPremisesInstances
  where
  type
    AWSResponse RemoveTagsFromOnPremisesInstances =
      RemoveTagsFromOnPremisesInstancesResponse
  request :: (Service -> Service)
-> RemoveTagsFromOnPremisesInstances
-> Request RemoveTagsFromOnPremisesInstances
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 RemoveTagsFromOnPremisesInstances
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse RemoveTagsFromOnPremisesInstances)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull
      RemoveTagsFromOnPremisesInstancesResponse
RemoveTagsFromOnPremisesInstancesResponse'

instance
  Prelude.Hashable
    RemoveTagsFromOnPremisesInstances
  where
  hashWithSalt :: Int -> RemoveTagsFromOnPremisesInstances -> Int
hashWithSalt
    Int
_salt
    RemoveTagsFromOnPremisesInstances' {[Text]
[Tag]
instanceNames :: [Text]
tags :: [Tag]
$sel:instanceNames:RemoveTagsFromOnPremisesInstances' :: RemoveTagsFromOnPremisesInstances -> [Text]
$sel:tags:RemoveTagsFromOnPremisesInstances' :: RemoveTagsFromOnPremisesInstances -> [Tag]
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [Tag]
tags
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [Text]
instanceNames

instance
  Prelude.NFData
    RemoveTagsFromOnPremisesInstances
  where
  rnf :: RemoveTagsFromOnPremisesInstances -> ()
rnf RemoveTagsFromOnPremisesInstances' {[Text]
[Tag]
instanceNames :: [Text]
tags :: [Tag]
$sel:instanceNames:RemoveTagsFromOnPremisesInstances' :: RemoveTagsFromOnPremisesInstances -> [Text]
$sel:tags:RemoveTagsFromOnPremisesInstances' :: RemoveTagsFromOnPremisesInstances -> [Tag]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf [Tag]
tags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [Text]
instanceNames

instance
  Data.ToHeaders
    RemoveTagsFromOnPremisesInstances
  where
  toHeaders :: RemoveTagsFromOnPremisesInstances -> [Header]
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> [Header]
Data.=# ( ByteString
"CodeDeploy_20141006.RemoveTagsFromOnPremisesInstances" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> [Header]
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance
  Data.ToJSON
    RemoveTagsFromOnPremisesInstances
  where
  toJSON :: RemoveTagsFromOnPremisesInstances -> Value
toJSON RemoveTagsFromOnPremisesInstances' {[Text]
[Tag]
instanceNames :: [Text]
tags :: [Tag]
$sel:instanceNames:RemoveTagsFromOnPremisesInstances' :: RemoveTagsFromOnPremisesInstances -> [Text]
$sel:tags:RemoveTagsFromOnPremisesInstances' :: RemoveTagsFromOnPremisesInstances -> [Tag]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just (Key
"tags" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [Tag]
tags),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"instanceNames" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [Text]
instanceNames)
          ]
      )

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

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

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

-- |
-- Create a value of 'RemoveTagsFromOnPremisesInstancesResponse' 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.
newRemoveTagsFromOnPremisesInstancesResponse ::
  RemoveTagsFromOnPremisesInstancesResponse
newRemoveTagsFromOnPremisesInstancesResponse :: RemoveTagsFromOnPremisesInstancesResponse
newRemoveTagsFromOnPremisesInstancesResponse =
  RemoveTagsFromOnPremisesInstancesResponse
RemoveTagsFromOnPremisesInstancesResponse'

instance
  Prelude.NFData
    RemoveTagsFromOnPremisesInstancesResponse
  where
  rnf :: RemoveTagsFromOnPremisesInstancesResponse -> ()
rnf RemoveTagsFromOnPremisesInstancesResponse
_ = ()