{-# 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-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)
--
-- 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.Lens as Lens
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
(RemoveTagsFromOnPremisesInstances
 -> RemoveTagsFromOnPremisesInstances -> Bool)
-> (RemoveTagsFromOnPremisesInstances
    -> RemoveTagsFromOnPremisesInstances -> Bool)
-> Eq RemoveTagsFromOnPremisesInstances
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]
(Int -> ReadS RemoveTagsFromOnPremisesInstances)
-> ReadS [RemoveTagsFromOnPremisesInstances]
-> ReadPrec RemoveTagsFromOnPremisesInstances
-> ReadPrec [RemoveTagsFromOnPremisesInstances]
-> Read 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
(Int -> RemoveTagsFromOnPremisesInstances -> ShowS)
-> (RemoveTagsFromOnPremisesInstances -> String)
-> ([RemoveTagsFromOnPremisesInstances] -> ShowS)
-> Show RemoveTagsFromOnPremisesInstances
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.
 RemoveTagsFromOnPremisesInstances
 -> Rep RemoveTagsFromOnPremisesInstances x)
-> (forall x.
    Rep RemoveTagsFromOnPremisesInstances x
    -> RemoveTagsFromOnPremisesInstances)
-> Generic RemoveTagsFromOnPremisesInstances
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' :: [Tag] -> [Text] -> RemoveTagsFromOnPremisesInstances
RemoveTagsFromOnPremisesInstances'
    { $sel:tags:RemoveTagsFromOnPremisesInstances' :: [Tag]
tags =
        [Tag]
forall a. Monoid a => a
Prelude.mempty,
      $sel:instanceNames:RemoveTagsFromOnPremisesInstances' :: [Text]
instanceNames = [Text]
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 :: ([Tag] -> f [Tag])
-> RemoveTagsFromOnPremisesInstances
-> f RemoveTagsFromOnPremisesInstances
removeTagsFromOnPremisesInstances_tags = (RemoveTagsFromOnPremisesInstances -> [Tag])
-> (RemoveTagsFromOnPremisesInstances
    -> [Tag] -> RemoveTagsFromOnPremisesInstances)
-> Lens
     RemoveTagsFromOnPremisesInstances
     RemoveTagsFromOnPremisesInstances
     [Tag]
     [Tag]
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) (([Tag] -> f [Tag])
 -> RemoveTagsFromOnPremisesInstances
 -> f RemoveTagsFromOnPremisesInstances)
-> (([Tag] -> f [Tag]) -> [Tag] -> f [Tag])
-> ([Tag] -> f [Tag])
-> RemoveTagsFromOnPremisesInstances
-> f RemoveTagsFromOnPremisesInstances
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Tag] -> f [Tag]) -> [Tag] -> f [Tag]
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 :: ([Text] -> f [Text])
-> RemoveTagsFromOnPremisesInstances
-> f RemoveTagsFromOnPremisesInstances
removeTagsFromOnPremisesInstances_instanceNames = (RemoveTagsFromOnPremisesInstances -> [Text])
-> (RemoveTagsFromOnPremisesInstances
    -> [Text] -> RemoveTagsFromOnPremisesInstances)
-> Lens
     RemoveTagsFromOnPremisesInstances
     RemoveTagsFromOnPremisesInstances
     [Text]
     [Text]
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) (([Text] -> f [Text])
 -> RemoveTagsFromOnPremisesInstances
 -> f RemoveTagsFromOnPremisesInstances)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> RemoveTagsFromOnPremisesInstances
-> f RemoveTagsFromOnPremisesInstances
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
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 :: RemoveTagsFromOnPremisesInstances
-> Request RemoveTagsFromOnPremisesInstances
request = Service
-> RemoveTagsFromOnPremisesInstances
-> Request RemoveTagsFromOnPremisesInstances
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy RemoveTagsFromOnPremisesInstances
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse RemoveTagsFromOnPremisesInstances)))
response =
    AWSResponse RemoveTagsFromOnPremisesInstances
-> Logger
-> Service
-> Proxy RemoveTagsFromOnPremisesInstances
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse RemoveTagsFromOnPremisesInstances)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull
      AWSResponse RemoveTagsFromOnPremisesInstances
RemoveTagsFromOnPremisesInstancesResponse
RemoveTagsFromOnPremisesInstancesResponse'

instance
  Prelude.Hashable
    RemoveTagsFromOnPremisesInstances

instance
  Prelude.NFData
    RemoveTagsFromOnPremisesInstances

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

instance
  Core.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
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"tags" Text -> [Tag] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Tag]
tags),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"instanceNames" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Text]
instanceNames)
          ]
      )

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

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

-- | /See:/ 'newRemoveTagsFromOnPremisesInstancesResponse' smart constructor.
data RemoveTagsFromOnPremisesInstancesResponse = RemoveTagsFromOnPremisesInstancesResponse'
  {
  }
  deriving (RemoveTagsFromOnPremisesInstancesResponse
-> RemoveTagsFromOnPremisesInstancesResponse -> Bool
(RemoveTagsFromOnPremisesInstancesResponse
 -> RemoveTagsFromOnPremisesInstancesResponse -> Bool)
-> (RemoveTagsFromOnPremisesInstancesResponse
    -> RemoveTagsFromOnPremisesInstancesResponse -> Bool)
-> Eq RemoveTagsFromOnPremisesInstancesResponse
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]
(Int -> ReadS RemoveTagsFromOnPremisesInstancesResponse)
-> ReadS [RemoveTagsFromOnPremisesInstancesResponse]
-> ReadPrec RemoveTagsFromOnPremisesInstancesResponse
-> ReadPrec [RemoveTagsFromOnPremisesInstancesResponse]
-> Read 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
(Int -> RemoveTagsFromOnPremisesInstancesResponse -> ShowS)
-> (RemoveTagsFromOnPremisesInstancesResponse -> String)
-> ([RemoveTagsFromOnPremisesInstancesResponse] -> ShowS)
-> Show RemoveTagsFromOnPremisesInstancesResponse
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.
 RemoveTagsFromOnPremisesInstancesResponse
 -> Rep RemoveTagsFromOnPremisesInstancesResponse x)
-> (forall x.
    Rep RemoveTagsFromOnPremisesInstancesResponse x
    -> RemoveTagsFromOnPremisesInstancesResponse)
-> Generic RemoveTagsFromOnPremisesInstancesResponse
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