{-# 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.CodeStar.UntagProject
-- 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 tags from a project.
module Amazonka.CodeStar.UntagProject
  ( -- * Creating a Request
    UntagProject (..),
    newUntagProject,

    -- * Request Lenses
    untagProject_id,
    untagProject_tags,

    -- * Destructuring the Response
    UntagProjectResponse (..),
    newUntagProjectResponse,

    -- * Response Lenses
    untagProjectResponse_httpStatus,
  )
where

import Amazonka.CodeStar.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

-- | /See:/ 'newUntagProject' smart constructor.
data UntagProject = UntagProject'
  { -- | The ID of the project to remove tags from.
    UntagProject -> Text
id :: Prelude.Text,
    -- | The tags to remove from the project.
    UntagProject -> [Text]
tags :: [Prelude.Text]
  }
  deriving (UntagProject -> UntagProject -> Bool
(UntagProject -> UntagProject -> Bool)
-> (UntagProject -> UntagProject -> Bool) -> Eq UntagProject
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UntagProject -> UntagProject -> Bool
$c/= :: UntagProject -> UntagProject -> Bool
== :: UntagProject -> UntagProject -> Bool
$c== :: UntagProject -> UntagProject -> Bool
Prelude.Eq, ReadPrec [UntagProject]
ReadPrec UntagProject
Int -> ReadS UntagProject
ReadS [UntagProject]
(Int -> ReadS UntagProject)
-> ReadS [UntagProject]
-> ReadPrec UntagProject
-> ReadPrec [UntagProject]
-> Read UntagProject
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UntagProject]
$creadListPrec :: ReadPrec [UntagProject]
readPrec :: ReadPrec UntagProject
$creadPrec :: ReadPrec UntagProject
readList :: ReadS [UntagProject]
$creadList :: ReadS [UntagProject]
readsPrec :: Int -> ReadS UntagProject
$creadsPrec :: Int -> ReadS UntagProject
Prelude.Read, Int -> UntagProject -> ShowS
[UntagProject] -> ShowS
UntagProject -> String
(Int -> UntagProject -> ShowS)
-> (UntagProject -> String)
-> ([UntagProject] -> ShowS)
-> Show UntagProject
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UntagProject] -> ShowS
$cshowList :: [UntagProject] -> ShowS
show :: UntagProject -> String
$cshow :: UntagProject -> String
showsPrec :: Int -> UntagProject -> ShowS
$cshowsPrec :: Int -> UntagProject -> ShowS
Prelude.Show, (forall x. UntagProject -> Rep UntagProject x)
-> (forall x. Rep UntagProject x -> UntagProject)
-> Generic UntagProject
forall x. Rep UntagProject x -> UntagProject
forall x. UntagProject -> Rep UntagProject x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UntagProject x -> UntagProject
$cfrom :: forall x. UntagProject -> Rep UntagProject x
Prelude.Generic)

-- |
-- Create a value of 'UntagProject' 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:
--
-- 'id', 'untagProject_id' - The ID of the project to remove tags from.
--
-- 'tags', 'untagProject_tags' - The tags to remove from the project.
newUntagProject ::
  -- | 'id'
  Prelude.Text ->
  UntagProject
newUntagProject :: Text -> UntagProject
newUntagProject Text
pId_ =
  UntagProject' :: Text -> [Text] -> UntagProject
UntagProject' {$sel:id:UntagProject' :: Text
id = Text
pId_, $sel:tags:UntagProject' :: [Text]
tags = [Text]
forall a. Monoid a => a
Prelude.mempty}

-- | The ID of the project to remove tags from.
untagProject_id :: Lens.Lens' UntagProject Prelude.Text
untagProject_id :: (Text -> f Text) -> UntagProject -> f UntagProject
untagProject_id = (UntagProject -> Text)
-> (UntagProject -> Text -> UntagProject)
-> Lens UntagProject UntagProject Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UntagProject' {Text
id :: Text
$sel:id:UntagProject' :: UntagProject -> Text
id} -> Text
id) (\s :: UntagProject
s@UntagProject' {} Text
a -> UntagProject
s {$sel:id:UntagProject' :: Text
id = Text
a} :: UntagProject)

-- | The tags to remove from the project.
untagProject_tags :: Lens.Lens' UntagProject [Prelude.Text]
untagProject_tags :: ([Text] -> f [Text]) -> UntagProject -> f UntagProject
untagProject_tags = (UntagProject -> [Text])
-> (UntagProject -> [Text] -> UntagProject)
-> Lens UntagProject UntagProject [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UntagProject' {[Text]
tags :: [Text]
$sel:tags:UntagProject' :: UntagProject -> [Text]
tags} -> [Text]
tags) (\s :: UntagProject
s@UntagProject' {} [Text]
a -> UntagProject
s {$sel:tags:UntagProject' :: [Text]
tags = [Text]
a} :: UntagProject) (([Text] -> f [Text]) -> UntagProject -> f UntagProject)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> UntagProject
-> f UntagProject
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 UntagProject where
  type AWSResponse UntagProject = UntagProjectResponse
  request :: UntagProject -> Request UntagProject
request = Service -> UntagProject -> Request UntagProject
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy UntagProject
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UntagProject)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse UntagProject))
-> Logger
-> Service
-> Proxy UntagProject
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UntagProject)))
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 -> UntagProjectResponse
UntagProjectResponse'
            (Int -> UntagProjectResponse)
-> Either String Int -> Either String UntagProjectResponse
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 UntagProject

instance Prelude.NFData UntagProject

instance Core.ToHeaders UntagProject where
  toHeaders :: UntagProject -> ResponseHeaders
toHeaders =
    ResponseHeaders -> UntagProject -> 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
"CodeStar_20170419.UntagProject" ::
                          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 UntagProject where
  toJSON :: UntagProject -> Value
toJSON UntagProject' {[Text]
Text
tags :: [Text]
id :: Text
$sel:tags:UntagProject' :: UntagProject -> [Text]
$sel:id:UntagProject' :: UntagProject -> 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
"id" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
id),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"tags" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Text]
tags)
          ]
      )

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

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

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

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

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

instance Prelude.NFData UntagProjectResponse