{-# 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.S3.GetObjectTagging
-- 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)
--
-- Returns the tag-set of an object. You send the GET request against the
-- tagging subresource associated with the object.
--
-- To use this operation, you must have permission to perform the
-- @s3:GetObjectTagging@ action. By default, the GET action returns
-- information about current version of an object. For a versioned bucket,
-- you can have multiple versions of an object in your bucket. To retrieve
-- tags of any other version, use the versionId query parameter. You also
-- need permission for the @s3:GetObjectVersionTagging@ action.
--
-- By default, the bucket owner has this permission and can grant this
-- permission to others.
--
-- For information about the Amazon S3 object tagging feature, see
-- <https://docs.aws.amazon.com/AmazonS3/latest/dev/object-tagging.html Object Tagging>.
--
-- The following action is related to @GetObjectTagging@:
--
-- -   <https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObjectTagging.html PutObjectTagging>
--
-- -   <https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteObjectTagging.html DeleteObjectTagging>
module Amazonka.S3.GetObjectTagging
  ( -- * Creating a Request
    GetObjectTagging (..),
    newGetObjectTagging,

    -- * Request Lenses
    getObjectTagging_versionId,
    getObjectTagging_requestPayer,
    getObjectTagging_expectedBucketOwner,
    getObjectTagging_bucket,
    getObjectTagging_key,

    -- * Destructuring the Response
    GetObjectTaggingResponse (..),
    newGetObjectTaggingResponse,

    -- * Response Lenses
    getObjectTaggingResponse_versionId,
    getObjectTaggingResponse_httpStatus,
    getObjectTaggingResponse_tagSet,
  )
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.S3.Types

-- | /See:/ 'newGetObjectTagging' smart constructor.
data GetObjectTagging = GetObjectTagging'
  { -- | The versionId of the object for which to get the tagging information.
    GetObjectTagging -> Maybe ObjectVersionId
versionId :: Prelude.Maybe ObjectVersionId,
    GetObjectTagging -> Maybe RequestPayer
requestPayer :: Prelude.Maybe RequestPayer,
    -- | The account ID of the expected bucket owner. If the bucket is owned by a
    -- different account, the request will fail with an HTTP
    -- @403 (Access Denied)@ error.
    GetObjectTagging -> Maybe Text
expectedBucketOwner :: Prelude.Maybe Prelude.Text,
    -- | The bucket name containing the object for which to get the tagging
    -- information.
    --
    -- When using this action with an access point, you must direct requests to
    -- the access point hostname. The access point hostname takes the form
    -- /AccessPointName/-/AccountId/.s3-accesspoint./Region/.amazonaws.com.
    -- When using this action with an access point through the Amazon Web
    -- Services SDKs, you provide the access point ARN in place of the bucket
    -- name. For more information about access point ARNs, see
    -- <https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html Using access points>
    -- in the /Amazon S3 User Guide/.
    --
    -- When using this action with Amazon S3 on Outposts, you must direct
    -- requests to the S3 on Outposts hostname. The S3 on Outposts hostname
    -- takes the form
    -- /AccessPointName/-/AccountId/./outpostID/.s3-outposts./Region/.amazonaws.com.
    -- When using this action using S3 on Outposts through the Amazon Web
    -- Services SDKs, you provide the Outposts bucket ARN in place of the
    -- bucket name. For more information about S3 on Outposts ARNs, see
    -- <https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html Using S3 on Outposts>
    -- in the /Amazon S3 User Guide/.
    GetObjectTagging -> BucketName
bucket :: BucketName,
    -- | Object key for which to get the tagging information.
    GetObjectTagging -> ObjectKey
key :: ObjectKey
  }
  deriving (GetObjectTagging -> GetObjectTagging -> Bool
(GetObjectTagging -> GetObjectTagging -> Bool)
-> (GetObjectTagging -> GetObjectTagging -> Bool)
-> Eq GetObjectTagging
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetObjectTagging -> GetObjectTagging -> Bool
$c/= :: GetObjectTagging -> GetObjectTagging -> Bool
== :: GetObjectTagging -> GetObjectTagging -> Bool
$c== :: GetObjectTagging -> GetObjectTagging -> Bool
Prelude.Eq, ReadPrec [GetObjectTagging]
ReadPrec GetObjectTagging
Int -> ReadS GetObjectTagging
ReadS [GetObjectTagging]
(Int -> ReadS GetObjectTagging)
-> ReadS [GetObjectTagging]
-> ReadPrec GetObjectTagging
-> ReadPrec [GetObjectTagging]
-> Read GetObjectTagging
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetObjectTagging]
$creadListPrec :: ReadPrec [GetObjectTagging]
readPrec :: ReadPrec GetObjectTagging
$creadPrec :: ReadPrec GetObjectTagging
readList :: ReadS [GetObjectTagging]
$creadList :: ReadS [GetObjectTagging]
readsPrec :: Int -> ReadS GetObjectTagging
$creadsPrec :: Int -> ReadS GetObjectTagging
Prelude.Read, Int -> GetObjectTagging -> ShowS
[GetObjectTagging] -> ShowS
GetObjectTagging -> String
(Int -> GetObjectTagging -> ShowS)
-> (GetObjectTagging -> String)
-> ([GetObjectTagging] -> ShowS)
-> Show GetObjectTagging
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetObjectTagging] -> ShowS
$cshowList :: [GetObjectTagging] -> ShowS
show :: GetObjectTagging -> String
$cshow :: GetObjectTagging -> String
showsPrec :: Int -> GetObjectTagging -> ShowS
$cshowsPrec :: Int -> GetObjectTagging -> ShowS
Prelude.Show, (forall x. GetObjectTagging -> Rep GetObjectTagging x)
-> (forall x. Rep GetObjectTagging x -> GetObjectTagging)
-> Generic GetObjectTagging
forall x. Rep GetObjectTagging x -> GetObjectTagging
forall x. GetObjectTagging -> Rep GetObjectTagging x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetObjectTagging x -> GetObjectTagging
$cfrom :: forall x. GetObjectTagging -> Rep GetObjectTagging x
Prelude.Generic)

-- |
-- Create a value of 'GetObjectTagging' 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:
--
-- 'versionId', 'getObjectTagging_versionId' - The versionId of the object for which to get the tagging information.
--
-- 'requestPayer', 'getObjectTagging_requestPayer' - Undocumented member.
--
-- 'expectedBucketOwner', 'getObjectTagging_expectedBucketOwner' - The account ID of the expected bucket owner. If the bucket is owned by a
-- different account, the request will fail with an HTTP
-- @403 (Access Denied)@ error.
--
-- 'bucket', 'getObjectTagging_bucket' - The bucket name containing the object for which to get the tagging
-- information.
--
-- When using this action with an access point, you must direct requests to
-- the access point hostname. The access point hostname takes the form
-- /AccessPointName/-/AccountId/.s3-accesspoint./Region/.amazonaws.com.
-- When using this action with an access point through the Amazon Web
-- Services SDKs, you provide the access point ARN in place of the bucket
-- name. For more information about access point ARNs, see
-- <https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html Using access points>
-- in the /Amazon S3 User Guide/.
--
-- When using this action with Amazon S3 on Outposts, you must direct
-- requests to the S3 on Outposts hostname. The S3 on Outposts hostname
-- takes the form
-- /AccessPointName/-/AccountId/./outpostID/.s3-outposts./Region/.amazonaws.com.
-- When using this action using S3 on Outposts through the Amazon Web
-- Services SDKs, you provide the Outposts bucket ARN in place of the
-- bucket name. For more information about S3 on Outposts ARNs, see
-- <https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html Using S3 on Outposts>
-- in the /Amazon S3 User Guide/.
--
-- 'key', 'getObjectTagging_key' - Object key for which to get the tagging information.
newGetObjectTagging ::
  -- | 'bucket'
  BucketName ->
  -- | 'key'
  ObjectKey ->
  GetObjectTagging
newGetObjectTagging :: BucketName -> ObjectKey -> GetObjectTagging
newGetObjectTagging BucketName
pBucket_ ObjectKey
pKey_ =
  GetObjectTagging' :: Maybe ObjectVersionId
-> Maybe RequestPayer
-> Maybe Text
-> BucketName
-> ObjectKey
-> GetObjectTagging
GetObjectTagging'
    { $sel:versionId:GetObjectTagging' :: Maybe ObjectVersionId
versionId = Maybe ObjectVersionId
forall a. Maybe a
Prelude.Nothing,
      $sel:requestPayer:GetObjectTagging' :: Maybe RequestPayer
requestPayer = Maybe RequestPayer
forall a. Maybe a
Prelude.Nothing,
      $sel:expectedBucketOwner:GetObjectTagging' :: Maybe Text
expectedBucketOwner = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:bucket:GetObjectTagging' :: BucketName
bucket = BucketName
pBucket_,
      $sel:key:GetObjectTagging' :: ObjectKey
key = ObjectKey
pKey_
    }

-- | The versionId of the object for which to get the tagging information.
getObjectTagging_versionId :: Lens.Lens' GetObjectTagging (Prelude.Maybe ObjectVersionId)
getObjectTagging_versionId :: (Maybe ObjectVersionId -> f (Maybe ObjectVersionId))
-> GetObjectTagging -> f GetObjectTagging
getObjectTagging_versionId = (GetObjectTagging -> Maybe ObjectVersionId)
-> (GetObjectTagging -> Maybe ObjectVersionId -> GetObjectTagging)
-> Lens
     GetObjectTagging
     GetObjectTagging
     (Maybe ObjectVersionId)
     (Maybe ObjectVersionId)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetObjectTagging' {Maybe ObjectVersionId
versionId :: Maybe ObjectVersionId
$sel:versionId:GetObjectTagging' :: GetObjectTagging -> Maybe ObjectVersionId
versionId} -> Maybe ObjectVersionId
versionId) (\s :: GetObjectTagging
s@GetObjectTagging' {} Maybe ObjectVersionId
a -> GetObjectTagging
s {$sel:versionId:GetObjectTagging' :: Maybe ObjectVersionId
versionId = Maybe ObjectVersionId
a} :: GetObjectTagging)

-- | Undocumented member.
getObjectTagging_requestPayer :: Lens.Lens' GetObjectTagging (Prelude.Maybe RequestPayer)
getObjectTagging_requestPayer :: (Maybe RequestPayer -> f (Maybe RequestPayer))
-> GetObjectTagging -> f GetObjectTagging
getObjectTagging_requestPayer = (GetObjectTagging -> Maybe RequestPayer)
-> (GetObjectTagging -> Maybe RequestPayer -> GetObjectTagging)
-> Lens
     GetObjectTagging
     GetObjectTagging
     (Maybe RequestPayer)
     (Maybe RequestPayer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetObjectTagging' {Maybe RequestPayer
requestPayer :: Maybe RequestPayer
$sel:requestPayer:GetObjectTagging' :: GetObjectTagging -> Maybe RequestPayer
requestPayer} -> Maybe RequestPayer
requestPayer) (\s :: GetObjectTagging
s@GetObjectTagging' {} Maybe RequestPayer
a -> GetObjectTagging
s {$sel:requestPayer:GetObjectTagging' :: Maybe RequestPayer
requestPayer = Maybe RequestPayer
a} :: GetObjectTagging)

-- | The account ID of the expected bucket owner. If the bucket is owned by a
-- different account, the request will fail with an HTTP
-- @403 (Access Denied)@ error.
getObjectTagging_expectedBucketOwner :: Lens.Lens' GetObjectTagging (Prelude.Maybe Prelude.Text)
getObjectTagging_expectedBucketOwner :: (Maybe Text -> f (Maybe Text))
-> GetObjectTagging -> f GetObjectTagging
getObjectTagging_expectedBucketOwner = (GetObjectTagging -> Maybe Text)
-> (GetObjectTagging -> Maybe Text -> GetObjectTagging)
-> Lens GetObjectTagging GetObjectTagging (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetObjectTagging' {Maybe Text
expectedBucketOwner :: Maybe Text
$sel:expectedBucketOwner:GetObjectTagging' :: GetObjectTagging -> Maybe Text
expectedBucketOwner} -> Maybe Text
expectedBucketOwner) (\s :: GetObjectTagging
s@GetObjectTagging' {} Maybe Text
a -> GetObjectTagging
s {$sel:expectedBucketOwner:GetObjectTagging' :: Maybe Text
expectedBucketOwner = Maybe Text
a} :: GetObjectTagging)

-- | The bucket name containing the object for which to get the tagging
-- information.
--
-- When using this action with an access point, you must direct requests to
-- the access point hostname. The access point hostname takes the form
-- /AccessPointName/-/AccountId/.s3-accesspoint./Region/.amazonaws.com.
-- When using this action with an access point through the Amazon Web
-- Services SDKs, you provide the access point ARN in place of the bucket
-- name. For more information about access point ARNs, see
-- <https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html Using access points>
-- in the /Amazon S3 User Guide/.
--
-- When using this action with Amazon S3 on Outposts, you must direct
-- requests to the S3 on Outposts hostname. The S3 on Outposts hostname
-- takes the form
-- /AccessPointName/-/AccountId/./outpostID/.s3-outposts./Region/.amazonaws.com.
-- When using this action using S3 on Outposts through the Amazon Web
-- Services SDKs, you provide the Outposts bucket ARN in place of the
-- bucket name. For more information about S3 on Outposts ARNs, see
-- <https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html Using S3 on Outposts>
-- in the /Amazon S3 User Guide/.
getObjectTagging_bucket :: Lens.Lens' GetObjectTagging BucketName
getObjectTagging_bucket :: (BucketName -> f BucketName)
-> GetObjectTagging -> f GetObjectTagging
getObjectTagging_bucket = (GetObjectTagging -> BucketName)
-> (GetObjectTagging -> BucketName -> GetObjectTagging)
-> Lens GetObjectTagging GetObjectTagging BucketName BucketName
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetObjectTagging' {BucketName
bucket :: BucketName
$sel:bucket:GetObjectTagging' :: GetObjectTagging -> BucketName
bucket} -> BucketName
bucket) (\s :: GetObjectTagging
s@GetObjectTagging' {} BucketName
a -> GetObjectTagging
s {$sel:bucket:GetObjectTagging' :: BucketName
bucket = BucketName
a} :: GetObjectTagging)

-- | Object key for which to get the tagging information.
getObjectTagging_key :: Lens.Lens' GetObjectTagging ObjectKey
getObjectTagging_key :: (ObjectKey -> f ObjectKey)
-> GetObjectTagging -> f GetObjectTagging
getObjectTagging_key = (GetObjectTagging -> ObjectKey)
-> (GetObjectTagging -> ObjectKey -> GetObjectTagging)
-> Lens GetObjectTagging GetObjectTagging ObjectKey ObjectKey
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetObjectTagging' {ObjectKey
key :: ObjectKey
$sel:key:GetObjectTagging' :: GetObjectTagging -> ObjectKey
key} -> ObjectKey
key) (\s :: GetObjectTagging
s@GetObjectTagging' {} ObjectKey
a -> GetObjectTagging
s {$sel:key:GetObjectTagging' :: ObjectKey
key = ObjectKey
a} :: GetObjectTagging)

instance Core.AWSRequest GetObjectTagging where
  type
    AWSResponse GetObjectTagging =
      GetObjectTaggingResponse
  request :: GetObjectTagging -> Request GetObjectTagging
request =
    Request GetObjectTagging -> Request GetObjectTagging
forall a. Request a -> Request a
Request.s3vhost
      (Request GetObjectTagging -> Request GetObjectTagging)
-> (GetObjectTagging -> Request GetObjectTagging)
-> GetObjectTagging
-> Request GetObjectTagging
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. Service -> GetObjectTagging -> Request GetObjectTagging
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy GetObjectTagging
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetObjectTagging)))
response =
    (Int
 -> ResponseHeaders
 -> [Node]
 -> Either String (AWSResponse GetObjectTagging))
-> Logger
-> Service
-> Proxy GetObjectTagging
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetObjectTagging)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXML
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe ObjectVersionId -> Int -> [Tag] -> GetObjectTaggingResponse
GetObjectTaggingResponse'
            (Maybe ObjectVersionId -> Int -> [Tag] -> GetObjectTaggingResponse)
-> Either String (Maybe ObjectVersionId)
-> Either String (Int -> [Tag] -> GetObjectTaggingResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (ResponseHeaders
h ResponseHeaders
-> HeaderName -> Either String (Maybe ObjectVersionId)
forall a.
FromText a =>
ResponseHeaders -> HeaderName -> Either String (Maybe a)
Core..#? HeaderName
"x-amz-version-id")
            Either String (Int -> [Tag] -> GetObjectTaggingResponse)
-> Either String Int
-> Either String ([Tag] -> GetObjectTaggingResponse)
forall (f :: * -> *) a b. Applicative f => 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))
            Either String ([Tag] -> GetObjectTaggingResponse)
-> Either String [Tag] -> Either String GetObjectTaggingResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"TagSet" Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
                            Either String [Node]
-> ([Node] -> Either String [Tag]) -> Either String [Tag]
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= Text -> [Node] -> Either String [Tag]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"Tag"
                        )
      )

instance Prelude.Hashable GetObjectTagging

instance Prelude.NFData GetObjectTagging

instance Core.ToHeaders GetObjectTagging where
  toHeaders :: GetObjectTagging -> ResponseHeaders
toHeaders GetObjectTagging' {Maybe Text
Maybe ObjectVersionId
Maybe RequestPayer
ObjectKey
BucketName
key :: ObjectKey
bucket :: BucketName
expectedBucketOwner :: Maybe Text
requestPayer :: Maybe RequestPayer
versionId :: Maybe ObjectVersionId
$sel:key:GetObjectTagging' :: GetObjectTagging -> ObjectKey
$sel:bucket:GetObjectTagging' :: GetObjectTagging -> BucketName
$sel:expectedBucketOwner:GetObjectTagging' :: GetObjectTagging -> Maybe Text
$sel:requestPayer:GetObjectTagging' :: GetObjectTagging -> Maybe RequestPayer
$sel:versionId:GetObjectTagging' :: GetObjectTagging -> Maybe ObjectVersionId
..} =
    [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ HeaderName
"x-amz-request-payer" HeaderName -> Maybe RequestPayer -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# Maybe RequestPayer
requestPayer,
        HeaderName
"x-amz-expected-bucket-owner"
          HeaderName -> Maybe Text -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# Maybe Text
expectedBucketOwner
      ]

instance Core.ToPath GetObjectTagging where
  toPath :: GetObjectTagging -> ByteString
toPath GetObjectTagging' {Maybe Text
Maybe ObjectVersionId
Maybe RequestPayer
ObjectKey
BucketName
key :: ObjectKey
bucket :: BucketName
expectedBucketOwner :: Maybe Text
requestPayer :: Maybe RequestPayer
versionId :: Maybe ObjectVersionId
$sel:key:GetObjectTagging' :: GetObjectTagging -> ObjectKey
$sel:bucket:GetObjectTagging' :: GetObjectTagging -> BucketName
$sel:expectedBucketOwner:GetObjectTagging' :: GetObjectTagging -> Maybe Text
$sel:requestPayer:GetObjectTagging' :: GetObjectTagging -> Maybe RequestPayer
$sel:versionId:GetObjectTagging' :: GetObjectTagging -> Maybe ObjectVersionId
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/", BucketName -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS BucketName
bucket, ByteString
"/", ObjectKey -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS ObjectKey
key]

instance Core.ToQuery GetObjectTagging where
  toQuery :: GetObjectTagging -> QueryString
toQuery GetObjectTagging' {Maybe Text
Maybe ObjectVersionId
Maybe RequestPayer
ObjectKey
BucketName
key :: ObjectKey
bucket :: BucketName
expectedBucketOwner :: Maybe Text
requestPayer :: Maybe RequestPayer
versionId :: Maybe ObjectVersionId
$sel:key:GetObjectTagging' :: GetObjectTagging -> ObjectKey
$sel:bucket:GetObjectTagging' :: GetObjectTagging -> BucketName
$sel:expectedBucketOwner:GetObjectTagging' :: GetObjectTagging -> Maybe Text
$sel:requestPayer:GetObjectTagging' :: GetObjectTagging -> Maybe RequestPayer
$sel:versionId:GetObjectTagging' :: GetObjectTagging -> Maybe ObjectVersionId
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"versionId" ByteString -> Maybe ObjectVersionId -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe ObjectVersionId
versionId, QueryString
"tagging"]

-- | /See:/ 'newGetObjectTaggingResponse' smart constructor.
data GetObjectTaggingResponse = GetObjectTaggingResponse'
  { -- | The versionId of the object for which you got the tagging information.
    GetObjectTaggingResponse -> Maybe ObjectVersionId
versionId :: Prelude.Maybe ObjectVersionId,
    -- | The response's http status code.
    GetObjectTaggingResponse -> Int
httpStatus :: Prelude.Int,
    -- | Contains the tag set.
    GetObjectTaggingResponse -> [Tag]
tagSet :: [Tag]
  }
  deriving (GetObjectTaggingResponse -> GetObjectTaggingResponse -> Bool
(GetObjectTaggingResponse -> GetObjectTaggingResponse -> Bool)
-> (GetObjectTaggingResponse -> GetObjectTaggingResponse -> Bool)
-> Eq GetObjectTaggingResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetObjectTaggingResponse -> GetObjectTaggingResponse -> Bool
$c/= :: GetObjectTaggingResponse -> GetObjectTaggingResponse -> Bool
== :: GetObjectTaggingResponse -> GetObjectTaggingResponse -> Bool
$c== :: GetObjectTaggingResponse -> GetObjectTaggingResponse -> Bool
Prelude.Eq, ReadPrec [GetObjectTaggingResponse]
ReadPrec GetObjectTaggingResponse
Int -> ReadS GetObjectTaggingResponse
ReadS [GetObjectTaggingResponse]
(Int -> ReadS GetObjectTaggingResponse)
-> ReadS [GetObjectTaggingResponse]
-> ReadPrec GetObjectTaggingResponse
-> ReadPrec [GetObjectTaggingResponse]
-> Read GetObjectTaggingResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetObjectTaggingResponse]
$creadListPrec :: ReadPrec [GetObjectTaggingResponse]
readPrec :: ReadPrec GetObjectTaggingResponse
$creadPrec :: ReadPrec GetObjectTaggingResponse
readList :: ReadS [GetObjectTaggingResponse]
$creadList :: ReadS [GetObjectTaggingResponse]
readsPrec :: Int -> ReadS GetObjectTaggingResponse
$creadsPrec :: Int -> ReadS GetObjectTaggingResponse
Prelude.Read, Int -> GetObjectTaggingResponse -> ShowS
[GetObjectTaggingResponse] -> ShowS
GetObjectTaggingResponse -> String
(Int -> GetObjectTaggingResponse -> ShowS)
-> (GetObjectTaggingResponse -> String)
-> ([GetObjectTaggingResponse] -> ShowS)
-> Show GetObjectTaggingResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetObjectTaggingResponse] -> ShowS
$cshowList :: [GetObjectTaggingResponse] -> ShowS
show :: GetObjectTaggingResponse -> String
$cshow :: GetObjectTaggingResponse -> String
showsPrec :: Int -> GetObjectTaggingResponse -> ShowS
$cshowsPrec :: Int -> GetObjectTaggingResponse -> ShowS
Prelude.Show, (forall x.
 GetObjectTaggingResponse -> Rep GetObjectTaggingResponse x)
-> (forall x.
    Rep GetObjectTaggingResponse x -> GetObjectTaggingResponse)
-> Generic GetObjectTaggingResponse
forall x.
Rep GetObjectTaggingResponse x -> GetObjectTaggingResponse
forall x.
GetObjectTaggingResponse -> Rep GetObjectTaggingResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetObjectTaggingResponse x -> GetObjectTaggingResponse
$cfrom :: forall x.
GetObjectTaggingResponse -> Rep GetObjectTaggingResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetObjectTaggingResponse' 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:
--
-- 'versionId', 'getObjectTaggingResponse_versionId' - The versionId of the object for which you got the tagging information.
--
-- 'httpStatus', 'getObjectTaggingResponse_httpStatus' - The response's http status code.
--
-- 'tagSet', 'getObjectTaggingResponse_tagSet' - Contains the tag set.
newGetObjectTaggingResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetObjectTaggingResponse
newGetObjectTaggingResponse :: Int -> GetObjectTaggingResponse
newGetObjectTaggingResponse Int
pHttpStatus_ =
  GetObjectTaggingResponse' :: Maybe ObjectVersionId -> Int -> [Tag] -> GetObjectTaggingResponse
GetObjectTaggingResponse'
    { $sel:versionId:GetObjectTaggingResponse' :: Maybe ObjectVersionId
versionId =
        Maybe ObjectVersionId
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetObjectTaggingResponse' :: Int
httpStatus = Int
pHttpStatus_,
      $sel:tagSet:GetObjectTaggingResponse' :: [Tag]
tagSet = [Tag]
forall a. Monoid a => a
Prelude.mempty
    }

-- | The versionId of the object for which you got the tagging information.
getObjectTaggingResponse_versionId :: Lens.Lens' GetObjectTaggingResponse (Prelude.Maybe ObjectVersionId)
getObjectTaggingResponse_versionId :: (Maybe ObjectVersionId -> f (Maybe ObjectVersionId))
-> GetObjectTaggingResponse -> f GetObjectTaggingResponse
getObjectTaggingResponse_versionId = (GetObjectTaggingResponse -> Maybe ObjectVersionId)
-> (GetObjectTaggingResponse
    -> Maybe ObjectVersionId -> GetObjectTaggingResponse)
-> Lens
     GetObjectTaggingResponse
     GetObjectTaggingResponse
     (Maybe ObjectVersionId)
     (Maybe ObjectVersionId)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetObjectTaggingResponse' {Maybe ObjectVersionId
versionId :: Maybe ObjectVersionId
$sel:versionId:GetObjectTaggingResponse' :: GetObjectTaggingResponse -> Maybe ObjectVersionId
versionId} -> Maybe ObjectVersionId
versionId) (\s :: GetObjectTaggingResponse
s@GetObjectTaggingResponse' {} Maybe ObjectVersionId
a -> GetObjectTaggingResponse
s {$sel:versionId:GetObjectTaggingResponse' :: Maybe ObjectVersionId
versionId = Maybe ObjectVersionId
a} :: GetObjectTaggingResponse)

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

-- | Contains the tag set.
getObjectTaggingResponse_tagSet :: Lens.Lens' GetObjectTaggingResponse [Tag]
getObjectTaggingResponse_tagSet :: ([Tag] -> f [Tag])
-> GetObjectTaggingResponse -> f GetObjectTaggingResponse
getObjectTaggingResponse_tagSet = (GetObjectTaggingResponse -> [Tag])
-> (GetObjectTaggingResponse -> [Tag] -> GetObjectTaggingResponse)
-> Lens
     GetObjectTaggingResponse GetObjectTaggingResponse [Tag] [Tag]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetObjectTaggingResponse' {[Tag]
tagSet :: [Tag]
$sel:tagSet:GetObjectTaggingResponse' :: GetObjectTaggingResponse -> [Tag]
tagSet} -> [Tag]
tagSet) (\s :: GetObjectTaggingResponse
s@GetObjectTaggingResponse' {} [Tag]
a -> GetObjectTaggingResponse
s {$sel:tagSet:GetObjectTaggingResponse' :: [Tag]
tagSet = [Tag]
a} :: GetObjectTaggingResponse) (([Tag] -> f [Tag])
 -> GetObjectTaggingResponse -> f GetObjectTaggingResponse)
-> (([Tag] -> f [Tag]) -> [Tag] -> f [Tag])
-> ([Tag] -> f [Tag])
-> GetObjectTaggingResponse
-> f GetObjectTaggingResponse
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

instance Prelude.NFData GetObjectTaggingResponse