amazonka-codeartifact-2.0: gen/Amazonka/CodeArtifact/DescribeDomain.hs
{-# 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.CodeArtifact.DescribeDomain
-- 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 a
-- <https://docs.aws.amazon.com/codeartifact/latest/APIReference/API_DomainDescription.html DomainDescription>
-- object that contains information about the requested domain.
module Amazonka.CodeArtifact.DescribeDomain
( -- * Creating a Request
DescribeDomain (..),
newDescribeDomain,
-- * Request Lenses
describeDomain_domainOwner,
describeDomain_domain,
-- * Destructuring the Response
DescribeDomainResponse (..),
newDescribeDomainResponse,
-- * Response Lenses
describeDomainResponse_domain,
describeDomainResponse_httpStatus,
)
where
import Amazonka.CodeArtifact.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:/ 'newDescribeDomain' smart constructor.
data DescribeDomain = DescribeDomain'
{ -- | The 12-digit account number of the Amazon Web Services account that owns
-- the domain. It does not include dashes or spaces.
domainOwner :: Prelude.Maybe Prelude.Text,
-- | A string that specifies the name of the requested domain.
domain :: Prelude.Text
}
deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic)
-- |
-- Create a value of 'DescribeDomain' 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:
--
-- 'domainOwner', 'describeDomain_domainOwner' - The 12-digit account number of the Amazon Web Services account that owns
-- the domain. It does not include dashes or spaces.
--
-- 'domain', 'describeDomain_domain' - A string that specifies the name of the requested domain.
newDescribeDomain ::
-- | 'domain'
Prelude.Text ->
DescribeDomain
newDescribeDomain pDomain_ =
DescribeDomain'
{ domainOwner = Prelude.Nothing,
domain = pDomain_
}
-- | The 12-digit account number of the Amazon Web Services account that owns
-- the domain. It does not include dashes or spaces.
describeDomain_domainOwner :: Lens.Lens' DescribeDomain (Prelude.Maybe Prelude.Text)
describeDomain_domainOwner = Lens.lens (\DescribeDomain' {domainOwner} -> domainOwner) (\s@DescribeDomain' {} a -> s {domainOwner = a} :: DescribeDomain)
-- | A string that specifies the name of the requested domain.
describeDomain_domain :: Lens.Lens' DescribeDomain Prelude.Text
describeDomain_domain = Lens.lens (\DescribeDomain' {domain} -> domain) (\s@DescribeDomain' {} a -> s {domain = a} :: DescribeDomain)
instance Core.AWSRequest DescribeDomain where
type
AWSResponse DescribeDomain =
DescribeDomainResponse
request overrides =
Request.get (overrides defaultService)
response =
Response.receiveJSON
( \s h x ->
DescribeDomainResponse'
Prelude.<$> (x Data..?> "domain")
Prelude.<*> (Prelude.pure (Prelude.fromEnum s))
)
instance Prelude.Hashable DescribeDomain where
hashWithSalt _salt DescribeDomain' {..} =
_salt
`Prelude.hashWithSalt` domainOwner
`Prelude.hashWithSalt` domain
instance Prelude.NFData DescribeDomain where
rnf DescribeDomain' {..} =
Prelude.rnf domainOwner
`Prelude.seq` Prelude.rnf domain
instance Data.ToHeaders DescribeDomain where
toHeaders =
Prelude.const
( Prelude.mconcat
[ "Content-Type"
Data.=# ( "application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToPath DescribeDomain where
toPath = Prelude.const "/v1/domain"
instance Data.ToQuery DescribeDomain where
toQuery DescribeDomain' {..} =
Prelude.mconcat
[ "domain-owner" Data.=: domainOwner,
"domain" Data.=: domain
]
-- | /See:/ 'newDescribeDomainResponse' smart constructor.
data DescribeDomainResponse = DescribeDomainResponse'
{ domain :: Prelude.Maybe DomainDescription,
-- | The response's http status code.
httpStatus :: Prelude.Int
}
deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic)
-- |
-- Create a value of 'DescribeDomainResponse' 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:
--
-- 'domain', 'describeDomainResponse_domain' - Undocumented member.
--
-- 'httpStatus', 'describeDomainResponse_httpStatus' - The response's http status code.
newDescribeDomainResponse ::
-- | 'httpStatus'
Prelude.Int ->
DescribeDomainResponse
newDescribeDomainResponse pHttpStatus_ =
DescribeDomainResponse'
{ domain = Prelude.Nothing,
httpStatus = pHttpStatus_
}
-- | Undocumented member.
describeDomainResponse_domain :: Lens.Lens' DescribeDomainResponse (Prelude.Maybe DomainDescription)
describeDomainResponse_domain = Lens.lens (\DescribeDomainResponse' {domain} -> domain) (\s@DescribeDomainResponse' {} a -> s {domain = a} :: DescribeDomainResponse)
-- | The response's http status code.
describeDomainResponse_httpStatus :: Lens.Lens' DescribeDomainResponse Prelude.Int
describeDomainResponse_httpStatus = Lens.lens (\DescribeDomainResponse' {httpStatus} -> httpStatus) (\s@DescribeDomainResponse' {} a -> s {httpStatus = a} :: DescribeDomainResponse)
instance Prelude.NFData DescribeDomainResponse where
rnf DescribeDomainResponse' {..} =
Prelude.rnf domain
`Prelude.seq` Prelude.rnf httpStatus