{-# 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.CloudFormation.DescribePublisher
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Returns information about a CloudFormation extension publisher.
--
-- If you don\'t supply a @PublisherId@, and you have registered as an
-- extension publisher, @DescribePublisher@ returns information about your
-- own publisher account.
--
-- For more information about registering as a publisher, see:
--
-- -   <https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_RegisterPublisher.html RegisterPublisher>
--
-- -   <https://docs.aws.amazon.com/cloudformation-cli/latest/userguide/publish-extension.html Publishing extensions to make them available for public use>
--     in the /CloudFormation CLI User Guide/
module Amazonka.CloudFormation.DescribePublisher
  ( -- * Creating a Request
    DescribePublisher (..),
    newDescribePublisher,

    -- * Request Lenses
    describePublisher_publisherId,

    -- * Destructuring the Response
    DescribePublisherResponse (..),
    newDescribePublisherResponse,

    -- * Response Lenses
    describePublisherResponse_identityProvider,
    describePublisherResponse_publisherId,
    describePublisherResponse_publisherProfile,
    describePublisherResponse_publisherStatus,
    describePublisherResponse_httpStatus,
  )
where

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

-- | /See:/ 'newDescribePublisher' smart constructor.
data DescribePublisher = DescribePublisher'
  { -- | The ID of the extension publisher.
    --
    -- If you don\'t supply a @PublisherId@, and you have registered as an
    -- extension publisher, @DescribePublisher@ returns information about your
    -- own publisher account.
    DescribePublisher -> Maybe Text
publisherId :: Prelude.Maybe Prelude.Text
  }
  deriving (DescribePublisher -> DescribePublisher -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribePublisher -> DescribePublisher -> Bool
$c/= :: DescribePublisher -> DescribePublisher -> Bool
== :: DescribePublisher -> DescribePublisher -> Bool
$c== :: DescribePublisher -> DescribePublisher -> Bool
Prelude.Eq, ReadPrec [DescribePublisher]
ReadPrec DescribePublisher
Int -> ReadS DescribePublisher
ReadS [DescribePublisher]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribePublisher]
$creadListPrec :: ReadPrec [DescribePublisher]
readPrec :: ReadPrec DescribePublisher
$creadPrec :: ReadPrec DescribePublisher
readList :: ReadS [DescribePublisher]
$creadList :: ReadS [DescribePublisher]
readsPrec :: Int -> ReadS DescribePublisher
$creadsPrec :: Int -> ReadS DescribePublisher
Prelude.Read, Int -> DescribePublisher -> ShowS
[DescribePublisher] -> ShowS
DescribePublisher -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribePublisher] -> ShowS
$cshowList :: [DescribePublisher] -> ShowS
show :: DescribePublisher -> String
$cshow :: DescribePublisher -> String
showsPrec :: Int -> DescribePublisher -> ShowS
$cshowsPrec :: Int -> DescribePublisher -> ShowS
Prelude.Show, forall x. Rep DescribePublisher x -> DescribePublisher
forall x. DescribePublisher -> Rep DescribePublisher x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribePublisher x -> DescribePublisher
$cfrom :: forall x. DescribePublisher -> Rep DescribePublisher x
Prelude.Generic)

-- |
-- Create a value of 'DescribePublisher' 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:
--
-- 'publisherId', 'describePublisher_publisherId' - The ID of the extension publisher.
--
-- If you don\'t supply a @PublisherId@, and you have registered as an
-- extension publisher, @DescribePublisher@ returns information about your
-- own publisher account.
newDescribePublisher ::
  DescribePublisher
newDescribePublisher :: DescribePublisher
newDescribePublisher =
  DescribePublisher' {$sel:publisherId:DescribePublisher' :: Maybe Text
publisherId = forall a. Maybe a
Prelude.Nothing}

-- | The ID of the extension publisher.
--
-- If you don\'t supply a @PublisherId@, and you have registered as an
-- extension publisher, @DescribePublisher@ returns information about your
-- own publisher account.
describePublisher_publisherId :: Lens.Lens' DescribePublisher (Prelude.Maybe Prelude.Text)
describePublisher_publisherId :: Lens' DescribePublisher (Maybe Text)
describePublisher_publisherId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribePublisher' {Maybe Text
publisherId :: Maybe Text
$sel:publisherId:DescribePublisher' :: DescribePublisher -> Maybe Text
publisherId} -> Maybe Text
publisherId) (\s :: DescribePublisher
s@DescribePublisher' {} Maybe Text
a -> DescribePublisher
s {$sel:publisherId:DescribePublisher' :: Maybe Text
publisherId = Maybe Text
a} :: DescribePublisher)

instance Core.AWSRequest DescribePublisher where
  type
    AWSResponse DescribePublisher =
      DescribePublisherResponse
  request :: (Service -> Service)
-> DescribePublisher -> Request DescribePublisher
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.postQuery (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DescribePublisher
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribePublisher)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"DescribePublisherResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe IdentityProvider
-> Maybe Text
-> Maybe Text
-> Maybe PublisherStatus
-> Int
-> DescribePublisherResponse
DescribePublisherResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"IdentityProvider")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"PublisherId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"PublisherProfile")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"PublisherStatus")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DescribePublisher where
  hashWithSalt :: Int -> DescribePublisher -> Int
hashWithSalt Int
_salt DescribePublisher' {Maybe Text
publisherId :: Maybe Text
$sel:publisherId:DescribePublisher' :: DescribePublisher -> Maybe Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
publisherId

instance Prelude.NFData DescribePublisher where
  rnf :: DescribePublisher -> ()
rnf DescribePublisher' {Maybe Text
publisherId :: Maybe Text
$sel:publisherId:DescribePublisher' :: DescribePublisher -> Maybe Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
publisherId

instance Data.ToHeaders DescribePublisher where
  toHeaders :: DescribePublisher -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

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

instance Data.ToQuery DescribePublisher where
  toQuery :: DescribePublisher -> QueryString
toQuery DescribePublisher' {Maybe Text
publisherId :: Maybe Text
$sel:publisherId:DescribePublisher' :: DescribePublisher -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"DescribePublisher" :: Prelude.ByteString),
        ByteString
"Version"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2010-05-15" :: Prelude.ByteString),
        ByteString
"PublisherId" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
publisherId
      ]

-- | /See:/ 'newDescribePublisherResponse' smart constructor.
data DescribePublisherResponse = DescribePublisherResponse'
  { -- | The type of account used as the identity provider when registering this
    -- publisher with CloudFormation.
    DescribePublisherResponse -> Maybe IdentityProvider
identityProvider :: Prelude.Maybe IdentityProvider,
    -- | The ID of the extension publisher.
    DescribePublisherResponse -> Maybe Text
publisherId :: Prelude.Maybe Prelude.Text,
    -- | The URL to the publisher\'s profile with the identity provider.
    DescribePublisherResponse -> Maybe Text
publisherProfile :: Prelude.Maybe Prelude.Text,
    -- | Whether the publisher is verified. Currently, all registered publishers
    -- are verified.
    DescribePublisherResponse -> Maybe PublisherStatus
publisherStatus :: Prelude.Maybe PublisherStatus,
    -- | The response's http status code.
    DescribePublisherResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribePublisherResponse -> DescribePublisherResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribePublisherResponse -> DescribePublisherResponse -> Bool
$c/= :: DescribePublisherResponse -> DescribePublisherResponse -> Bool
== :: DescribePublisherResponse -> DescribePublisherResponse -> Bool
$c== :: DescribePublisherResponse -> DescribePublisherResponse -> Bool
Prelude.Eq, ReadPrec [DescribePublisherResponse]
ReadPrec DescribePublisherResponse
Int -> ReadS DescribePublisherResponse
ReadS [DescribePublisherResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribePublisherResponse]
$creadListPrec :: ReadPrec [DescribePublisherResponse]
readPrec :: ReadPrec DescribePublisherResponse
$creadPrec :: ReadPrec DescribePublisherResponse
readList :: ReadS [DescribePublisherResponse]
$creadList :: ReadS [DescribePublisherResponse]
readsPrec :: Int -> ReadS DescribePublisherResponse
$creadsPrec :: Int -> ReadS DescribePublisherResponse
Prelude.Read, Int -> DescribePublisherResponse -> ShowS
[DescribePublisherResponse] -> ShowS
DescribePublisherResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribePublisherResponse] -> ShowS
$cshowList :: [DescribePublisherResponse] -> ShowS
show :: DescribePublisherResponse -> String
$cshow :: DescribePublisherResponse -> String
showsPrec :: Int -> DescribePublisherResponse -> ShowS
$cshowsPrec :: Int -> DescribePublisherResponse -> ShowS
Prelude.Show, forall x.
Rep DescribePublisherResponse x -> DescribePublisherResponse
forall x.
DescribePublisherResponse -> Rep DescribePublisherResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribePublisherResponse x -> DescribePublisherResponse
$cfrom :: forall x.
DescribePublisherResponse -> Rep DescribePublisherResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribePublisherResponse' 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:
--
-- 'identityProvider', 'describePublisherResponse_identityProvider' - The type of account used as the identity provider when registering this
-- publisher with CloudFormation.
--
-- 'publisherId', 'describePublisherResponse_publisherId' - The ID of the extension publisher.
--
-- 'publisherProfile', 'describePublisherResponse_publisherProfile' - The URL to the publisher\'s profile with the identity provider.
--
-- 'publisherStatus', 'describePublisherResponse_publisherStatus' - Whether the publisher is verified. Currently, all registered publishers
-- are verified.
--
-- 'httpStatus', 'describePublisherResponse_httpStatus' - The response's http status code.
newDescribePublisherResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribePublisherResponse
newDescribePublisherResponse :: Int -> DescribePublisherResponse
newDescribePublisherResponse Int
pHttpStatus_ =
  DescribePublisherResponse'
    { $sel:identityProvider:DescribePublisherResponse' :: Maybe IdentityProvider
identityProvider =
        forall a. Maybe a
Prelude.Nothing,
      $sel:publisherId:DescribePublisherResponse' :: Maybe Text
publisherId = forall a. Maybe a
Prelude.Nothing,
      $sel:publisherProfile:DescribePublisherResponse' :: Maybe Text
publisherProfile = forall a. Maybe a
Prelude.Nothing,
      $sel:publisherStatus:DescribePublisherResponse' :: Maybe PublisherStatus
publisherStatus = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribePublisherResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The type of account used as the identity provider when registering this
-- publisher with CloudFormation.
describePublisherResponse_identityProvider :: Lens.Lens' DescribePublisherResponse (Prelude.Maybe IdentityProvider)
describePublisherResponse_identityProvider :: Lens' DescribePublisherResponse (Maybe IdentityProvider)
describePublisherResponse_identityProvider = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribePublisherResponse' {Maybe IdentityProvider
identityProvider :: Maybe IdentityProvider
$sel:identityProvider:DescribePublisherResponse' :: DescribePublisherResponse -> Maybe IdentityProvider
identityProvider} -> Maybe IdentityProvider
identityProvider) (\s :: DescribePublisherResponse
s@DescribePublisherResponse' {} Maybe IdentityProvider
a -> DescribePublisherResponse
s {$sel:identityProvider:DescribePublisherResponse' :: Maybe IdentityProvider
identityProvider = Maybe IdentityProvider
a} :: DescribePublisherResponse)

-- | The ID of the extension publisher.
describePublisherResponse_publisherId :: Lens.Lens' DescribePublisherResponse (Prelude.Maybe Prelude.Text)
describePublisherResponse_publisherId :: Lens' DescribePublisherResponse (Maybe Text)
describePublisherResponse_publisherId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribePublisherResponse' {Maybe Text
publisherId :: Maybe Text
$sel:publisherId:DescribePublisherResponse' :: DescribePublisherResponse -> Maybe Text
publisherId} -> Maybe Text
publisherId) (\s :: DescribePublisherResponse
s@DescribePublisherResponse' {} Maybe Text
a -> DescribePublisherResponse
s {$sel:publisherId:DescribePublisherResponse' :: Maybe Text
publisherId = Maybe Text
a} :: DescribePublisherResponse)

-- | The URL to the publisher\'s profile with the identity provider.
describePublisherResponse_publisherProfile :: Lens.Lens' DescribePublisherResponse (Prelude.Maybe Prelude.Text)
describePublisherResponse_publisherProfile :: Lens' DescribePublisherResponse (Maybe Text)
describePublisherResponse_publisherProfile = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribePublisherResponse' {Maybe Text
publisherProfile :: Maybe Text
$sel:publisherProfile:DescribePublisherResponse' :: DescribePublisherResponse -> Maybe Text
publisherProfile} -> Maybe Text
publisherProfile) (\s :: DescribePublisherResponse
s@DescribePublisherResponse' {} Maybe Text
a -> DescribePublisherResponse
s {$sel:publisherProfile:DescribePublisherResponse' :: Maybe Text
publisherProfile = Maybe Text
a} :: DescribePublisherResponse)

-- | Whether the publisher is verified. Currently, all registered publishers
-- are verified.
describePublisherResponse_publisherStatus :: Lens.Lens' DescribePublisherResponse (Prelude.Maybe PublisherStatus)
describePublisherResponse_publisherStatus :: Lens' DescribePublisherResponse (Maybe PublisherStatus)
describePublisherResponse_publisherStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribePublisherResponse' {Maybe PublisherStatus
publisherStatus :: Maybe PublisherStatus
$sel:publisherStatus:DescribePublisherResponse' :: DescribePublisherResponse -> Maybe PublisherStatus
publisherStatus} -> Maybe PublisherStatus
publisherStatus) (\s :: DescribePublisherResponse
s@DescribePublisherResponse' {} Maybe PublisherStatus
a -> DescribePublisherResponse
s {$sel:publisherStatus:DescribePublisherResponse' :: Maybe PublisherStatus
publisherStatus = Maybe PublisherStatus
a} :: DescribePublisherResponse)

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

instance Prelude.NFData DescribePublisherResponse where
  rnf :: DescribePublisherResponse -> ()
rnf DescribePublisherResponse' {Int
Maybe Text
Maybe IdentityProvider
Maybe PublisherStatus
httpStatus :: Int
publisherStatus :: Maybe PublisherStatus
publisherProfile :: Maybe Text
publisherId :: Maybe Text
identityProvider :: Maybe IdentityProvider
$sel:httpStatus:DescribePublisherResponse' :: DescribePublisherResponse -> Int
$sel:publisherStatus:DescribePublisherResponse' :: DescribePublisherResponse -> Maybe PublisherStatus
$sel:publisherProfile:DescribePublisherResponse' :: DescribePublisherResponse -> Maybe Text
$sel:publisherId:DescribePublisherResponse' :: DescribePublisherResponse -> Maybe Text
$sel:identityProvider:DescribePublisherResponse' :: DescribePublisherResponse -> Maybe IdentityProvider
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe IdentityProvider
identityProvider
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
publisherId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
publisherProfile
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe PublisherStatus
publisherStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus