{-# 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.Amplify.UpdateDomainAssociation
-- 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)
--
-- Creates a new domain association for an Amplify app.
module Amazonka.Amplify.UpdateDomainAssociation
  ( -- * Creating a Request
    UpdateDomainAssociation (..),
    newUpdateDomainAssociation,

    -- * Request Lenses
    updateDomainAssociation_enableAutoSubDomain,
    updateDomainAssociation_autoSubDomainCreationPatterns,
    updateDomainAssociation_autoSubDomainIAMRole,
    updateDomainAssociation_appId,
    updateDomainAssociation_domainName,
    updateDomainAssociation_subDomainSettings,

    -- * Destructuring the Response
    UpdateDomainAssociationResponse (..),
    newUpdateDomainAssociationResponse,

    -- * Response Lenses
    updateDomainAssociationResponse_httpStatus,
    updateDomainAssociationResponse_domainAssociation,
  )
where

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

-- | The request structure for the update domain association request.
--
-- /See:/ 'newUpdateDomainAssociation' smart constructor.
data UpdateDomainAssociation = UpdateDomainAssociation'
  { -- | Enables the automated creation of subdomains for branches.
    UpdateDomainAssociation -> Maybe Bool
enableAutoSubDomain :: Prelude.Maybe Prelude.Bool,
    -- | Sets the branch patterns for automatic subdomain creation.
    UpdateDomainAssociation -> Maybe [Text]
autoSubDomainCreationPatterns :: Prelude.Maybe [Prelude.Text],
    -- | The required AWS Identity and Access Management (IAM) service role for
    -- the Amazon Resource Name (ARN) for automatically creating subdomains.
    UpdateDomainAssociation -> Maybe Text
autoSubDomainIAMRole :: Prelude.Maybe Prelude.Text,
    -- | The unique ID for an Amplify app.
    UpdateDomainAssociation -> Text
appId :: Prelude.Text,
    -- | The name of the domain.
    UpdateDomainAssociation -> Text
domainName :: Prelude.Text,
    -- | Describes the settings for the subdomain.
    UpdateDomainAssociation -> [SubDomainSetting]
subDomainSettings :: [SubDomainSetting]
  }
  deriving (UpdateDomainAssociation -> UpdateDomainAssociation -> Bool
(UpdateDomainAssociation -> UpdateDomainAssociation -> Bool)
-> (UpdateDomainAssociation -> UpdateDomainAssociation -> Bool)
-> Eq UpdateDomainAssociation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateDomainAssociation -> UpdateDomainAssociation -> Bool
$c/= :: UpdateDomainAssociation -> UpdateDomainAssociation -> Bool
== :: UpdateDomainAssociation -> UpdateDomainAssociation -> Bool
$c== :: UpdateDomainAssociation -> UpdateDomainAssociation -> Bool
Prelude.Eq, ReadPrec [UpdateDomainAssociation]
ReadPrec UpdateDomainAssociation
Int -> ReadS UpdateDomainAssociation
ReadS [UpdateDomainAssociation]
(Int -> ReadS UpdateDomainAssociation)
-> ReadS [UpdateDomainAssociation]
-> ReadPrec UpdateDomainAssociation
-> ReadPrec [UpdateDomainAssociation]
-> Read UpdateDomainAssociation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateDomainAssociation]
$creadListPrec :: ReadPrec [UpdateDomainAssociation]
readPrec :: ReadPrec UpdateDomainAssociation
$creadPrec :: ReadPrec UpdateDomainAssociation
readList :: ReadS [UpdateDomainAssociation]
$creadList :: ReadS [UpdateDomainAssociation]
readsPrec :: Int -> ReadS UpdateDomainAssociation
$creadsPrec :: Int -> ReadS UpdateDomainAssociation
Prelude.Read, Int -> UpdateDomainAssociation -> ShowS
[UpdateDomainAssociation] -> ShowS
UpdateDomainAssociation -> String
(Int -> UpdateDomainAssociation -> ShowS)
-> (UpdateDomainAssociation -> String)
-> ([UpdateDomainAssociation] -> ShowS)
-> Show UpdateDomainAssociation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateDomainAssociation] -> ShowS
$cshowList :: [UpdateDomainAssociation] -> ShowS
show :: UpdateDomainAssociation -> String
$cshow :: UpdateDomainAssociation -> String
showsPrec :: Int -> UpdateDomainAssociation -> ShowS
$cshowsPrec :: Int -> UpdateDomainAssociation -> ShowS
Prelude.Show, (forall x.
 UpdateDomainAssociation -> Rep UpdateDomainAssociation x)
-> (forall x.
    Rep UpdateDomainAssociation x -> UpdateDomainAssociation)
-> Generic UpdateDomainAssociation
forall x. Rep UpdateDomainAssociation x -> UpdateDomainAssociation
forall x. UpdateDomainAssociation -> Rep UpdateDomainAssociation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateDomainAssociation x -> UpdateDomainAssociation
$cfrom :: forall x. UpdateDomainAssociation -> Rep UpdateDomainAssociation x
Prelude.Generic)

-- |
-- Create a value of 'UpdateDomainAssociation' 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:
--
-- 'enableAutoSubDomain', 'updateDomainAssociation_enableAutoSubDomain' - Enables the automated creation of subdomains for branches.
--
-- 'autoSubDomainCreationPatterns', 'updateDomainAssociation_autoSubDomainCreationPatterns' - Sets the branch patterns for automatic subdomain creation.
--
-- 'autoSubDomainIAMRole', 'updateDomainAssociation_autoSubDomainIAMRole' - The required AWS Identity and Access Management (IAM) service role for
-- the Amazon Resource Name (ARN) for automatically creating subdomains.
--
-- 'appId', 'updateDomainAssociation_appId' - The unique ID for an Amplify app.
--
-- 'domainName', 'updateDomainAssociation_domainName' - The name of the domain.
--
-- 'subDomainSettings', 'updateDomainAssociation_subDomainSettings' - Describes the settings for the subdomain.
newUpdateDomainAssociation ::
  -- | 'appId'
  Prelude.Text ->
  -- | 'domainName'
  Prelude.Text ->
  UpdateDomainAssociation
newUpdateDomainAssociation :: Text -> Text -> UpdateDomainAssociation
newUpdateDomainAssociation Text
pAppId_ Text
pDomainName_ =
  UpdateDomainAssociation' :: Maybe Bool
-> Maybe [Text]
-> Maybe Text
-> Text
-> Text
-> [SubDomainSetting]
-> UpdateDomainAssociation
UpdateDomainAssociation'
    { $sel:enableAutoSubDomain:UpdateDomainAssociation' :: Maybe Bool
enableAutoSubDomain =
        Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:autoSubDomainCreationPatterns:UpdateDomainAssociation' :: Maybe [Text]
autoSubDomainCreationPatterns = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:autoSubDomainIAMRole:UpdateDomainAssociation' :: Maybe Text
autoSubDomainIAMRole = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:appId:UpdateDomainAssociation' :: Text
appId = Text
pAppId_,
      $sel:domainName:UpdateDomainAssociation' :: Text
domainName = Text
pDomainName_,
      $sel:subDomainSettings:UpdateDomainAssociation' :: [SubDomainSetting]
subDomainSettings = [SubDomainSetting]
forall a. Monoid a => a
Prelude.mempty
    }

-- | Enables the automated creation of subdomains for branches.
updateDomainAssociation_enableAutoSubDomain :: Lens.Lens' UpdateDomainAssociation (Prelude.Maybe Prelude.Bool)
updateDomainAssociation_enableAutoSubDomain :: (Maybe Bool -> f (Maybe Bool))
-> UpdateDomainAssociation -> f UpdateDomainAssociation
updateDomainAssociation_enableAutoSubDomain = (UpdateDomainAssociation -> Maybe Bool)
-> (UpdateDomainAssociation
    -> Maybe Bool -> UpdateDomainAssociation)
-> Lens
     UpdateDomainAssociation
     UpdateDomainAssociation
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDomainAssociation' {Maybe Bool
enableAutoSubDomain :: Maybe Bool
$sel:enableAutoSubDomain:UpdateDomainAssociation' :: UpdateDomainAssociation -> Maybe Bool
enableAutoSubDomain} -> Maybe Bool
enableAutoSubDomain) (\s :: UpdateDomainAssociation
s@UpdateDomainAssociation' {} Maybe Bool
a -> UpdateDomainAssociation
s {$sel:enableAutoSubDomain:UpdateDomainAssociation' :: Maybe Bool
enableAutoSubDomain = Maybe Bool
a} :: UpdateDomainAssociation)

-- | Sets the branch patterns for automatic subdomain creation.
updateDomainAssociation_autoSubDomainCreationPatterns :: Lens.Lens' UpdateDomainAssociation (Prelude.Maybe [Prelude.Text])
updateDomainAssociation_autoSubDomainCreationPatterns :: (Maybe [Text] -> f (Maybe [Text]))
-> UpdateDomainAssociation -> f UpdateDomainAssociation
updateDomainAssociation_autoSubDomainCreationPatterns = (UpdateDomainAssociation -> Maybe [Text])
-> (UpdateDomainAssociation
    -> Maybe [Text] -> UpdateDomainAssociation)
-> Lens
     UpdateDomainAssociation
     UpdateDomainAssociation
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDomainAssociation' {Maybe [Text]
autoSubDomainCreationPatterns :: Maybe [Text]
$sel:autoSubDomainCreationPatterns:UpdateDomainAssociation' :: UpdateDomainAssociation -> Maybe [Text]
autoSubDomainCreationPatterns} -> Maybe [Text]
autoSubDomainCreationPatterns) (\s :: UpdateDomainAssociation
s@UpdateDomainAssociation' {} Maybe [Text]
a -> UpdateDomainAssociation
s {$sel:autoSubDomainCreationPatterns:UpdateDomainAssociation' :: Maybe [Text]
autoSubDomainCreationPatterns = Maybe [Text]
a} :: UpdateDomainAssociation) ((Maybe [Text] -> f (Maybe [Text]))
 -> UpdateDomainAssociation -> f UpdateDomainAssociation)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> UpdateDomainAssociation
-> f UpdateDomainAssociation
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The required AWS Identity and Access Management (IAM) service role for
-- the Amazon Resource Name (ARN) for automatically creating subdomains.
updateDomainAssociation_autoSubDomainIAMRole :: Lens.Lens' UpdateDomainAssociation (Prelude.Maybe Prelude.Text)
updateDomainAssociation_autoSubDomainIAMRole :: (Maybe Text -> f (Maybe Text))
-> UpdateDomainAssociation -> f UpdateDomainAssociation
updateDomainAssociation_autoSubDomainIAMRole = (UpdateDomainAssociation -> Maybe Text)
-> (UpdateDomainAssociation
    -> Maybe Text -> UpdateDomainAssociation)
-> Lens
     UpdateDomainAssociation
     UpdateDomainAssociation
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDomainAssociation' {Maybe Text
autoSubDomainIAMRole :: Maybe Text
$sel:autoSubDomainIAMRole:UpdateDomainAssociation' :: UpdateDomainAssociation -> Maybe Text
autoSubDomainIAMRole} -> Maybe Text
autoSubDomainIAMRole) (\s :: UpdateDomainAssociation
s@UpdateDomainAssociation' {} Maybe Text
a -> UpdateDomainAssociation
s {$sel:autoSubDomainIAMRole:UpdateDomainAssociation' :: Maybe Text
autoSubDomainIAMRole = Maybe Text
a} :: UpdateDomainAssociation)

-- | The unique ID for an Amplify app.
updateDomainAssociation_appId :: Lens.Lens' UpdateDomainAssociation Prelude.Text
updateDomainAssociation_appId :: (Text -> f Text)
-> UpdateDomainAssociation -> f UpdateDomainAssociation
updateDomainAssociation_appId = (UpdateDomainAssociation -> Text)
-> (UpdateDomainAssociation -> Text -> UpdateDomainAssociation)
-> Lens UpdateDomainAssociation UpdateDomainAssociation Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDomainAssociation' {Text
appId :: Text
$sel:appId:UpdateDomainAssociation' :: UpdateDomainAssociation -> Text
appId} -> Text
appId) (\s :: UpdateDomainAssociation
s@UpdateDomainAssociation' {} Text
a -> UpdateDomainAssociation
s {$sel:appId:UpdateDomainAssociation' :: Text
appId = Text
a} :: UpdateDomainAssociation)

-- | The name of the domain.
updateDomainAssociation_domainName :: Lens.Lens' UpdateDomainAssociation Prelude.Text
updateDomainAssociation_domainName :: (Text -> f Text)
-> UpdateDomainAssociation -> f UpdateDomainAssociation
updateDomainAssociation_domainName = (UpdateDomainAssociation -> Text)
-> (UpdateDomainAssociation -> Text -> UpdateDomainAssociation)
-> Lens UpdateDomainAssociation UpdateDomainAssociation Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDomainAssociation' {Text
domainName :: Text
$sel:domainName:UpdateDomainAssociation' :: UpdateDomainAssociation -> Text
domainName} -> Text
domainName) (\s :: UpdateDomainAssociation
s@UpdateDomainAssociation' {} Text
a -> UpdateDomainAssociation
s {$sel:domainName:UpdateDomainAssociation' :: Text
domainName = Text
a} :: UpdateDomainAssociation)

-- | Describes the settings for the subdomain.
updateDomainAssociation_subDomainSettings :: Lens.Lens' UpdateDomainAssociation [SubDomainSetting]
updateDomainAssociation_subDomainSettings :: ([SubDomainSetting] -> f [SubDomainSetting])
-> UpdateDomainAssociation -> f UpdateDomainAssociation
updateDomainAssociation_subDomainSettings = (UpdateDomainAssociation -> [SubDomainSetting])
-> (UpdateDomainAssociation
    -> [SubDomainSetting] -> UpdateDomainAssociation)
-> Lens
     UpdateDomainAssociation
     UpdateDomainAssociation
     [SubDomainSetting]
     [SubDomainSetting]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDomainAssociation' {[SubDomainSetting]
subDomainSettings :: [SubDomainSetting]
$sel:subDomainSettings:UpdateDomainAssociation' :: UpdateDomainAssociation -> [SubDomainSetting]
subDomainSettings} -> [SubDomainSetting]
subDomainSettings) (\s :: UpdateDomainAssociation
s@UpdateDomainAssociation' {} [SubDomainSetting]
a -> UpdateDomainAssociation
s {$sel:subDomainSettings:UpdateDomainAssociation' :: [SubDomainSetting]
subDomainSettings = [SubDomainSetting]
a} :: UpdateDomainAssociation) (([SubDomainSetting] -> f [SubDomainSetting])
 -> UpdateDomainAssociation -> f UpdateDomainAssociation)
-> (([SubDomainSetting] -> f [SubDomainSetting])
    -> [SubDomainSetting] -> f [SubDomainSetting])
-> ([SubDomainSetting] -> f [SubDomainSetting])
-> UpdateDomainAssociation
-> f UpdateDomainAssociation
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([SubDomainSetting] -> f [SubDomainSetting])
-> [SubDomainSetting] -> f [SubDomainSetting]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.AWSRequest UpdateDomainAssociation where
  type
    AWSResponse UpdateDomainAssociation =
      UpdateDomainAssociationResponse
  request :: UpdateDomainAssociation -> Request UpdateDomainAssociation
request = Service
-> UpdateDomainAssociation -> Request UpdateDomainAssociation
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy UpdateDomainAssociation
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateDomainAssociation)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse UpdateDomainAssociation))
-> Logger
-> Service
-> Proxy UpdateDomainAssociation
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateDomainAssociation)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Int -> DomainAssociation -> UpdateDomainAssociationResponse
UpdateDomainAssociationResponse'
            (Int -> DomainAssociation -> UpdateDomainAssociationResponse)
-> Either String Int
-> Either
     String (DomainAssociation -> UpdateDomainAssociationResponse)
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))
            Either
  String (DomainAssociation -> UpdateDomainAssociationResponse)
-> Either String DomainAssociation
-> Either String UpdateDomainAssociationResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String DomainAssociation
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"domainAssociation")
      )

instance Prelude.Hashable UpdateDomainAssociation

instance Prelude.NFData UpdateDomainAssociation

instance Core.ToHeaders UpdateDomainAssociation where
  toHeaders :: UpdateDomainAssociation -> ResponseHeaders
toHeaders =
    ResponseHeaders -> UpdateDomainAssociation -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ 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 UpdateDomainAssociation where
  toJSON :: UpdateDomainAssociation -> Value
toJSON UpdateDomainAssociation' {[SubDomainSetting]
Maybe Bool
Maybe [Text]
Maybe Text
Text
subDomainSettings :: [SubDomainSetting]
domainName :: Text
appId :: Text
autoSubDomainIAMRole :: Maybe Text
autoSubDomainCreationPatterns :: Maybe [Text]
enableAutoSubDomain :: Maybe Bool
$sel:subDomainSettings:UpdateDomainAssociation' :: UpdateDomainAssociation -> [SubDomainSetting]
$sel:domainName:UpdateDomainAssociation' :: UpdateDomainAssociation -> Text
$sel:appId:UpdateDomainAssociation' :: UpdateDomainAssociation -> Text
$sel:autoSubDomainIAMRole:UpdateDomainAssociation' :: UpdateDomainAssociation -> Maybe Text
$sel:autoSubDomainCreationPatterns:UpdateDomainAssociation' :: UpdateDomainAssociation -> Maybe [Text]
$sel:enableAutoSubDomain:UpdateDomainAssociation' :: UpdateDomainAssociation -> Maybe Bool
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"enableAutoSubDomain" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
enableAutoSubDomain,
            (Text
"autoSubDomainCreationPatterns" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([Text] -> Pair) -> Maybe [Text] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
autoSubDomainCreationPatterns,
            (Text
"autoSubDomainIAMRole" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
autoSubDomainIAMRole,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"subDomainSettings" Text -> [SubDomainSetting] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [SubDomainSetting]
subDomainSettings)
          ]
      )

instance Core.ToPath UpdateDomainAssociation where
  toPath :: UpdateDomainAssociation -> ByteString
toPath UpdateDomainAssociation' {[SubDomainSetting]
Maybe Bool
Maybe [Text]
Maybe Text
Text
subDomainSettings :: [SubDomainSetting]
domainName :: Text
appId :: Text
autoSubDomainIAMRole :: Maybe Text
autoSubDomainCreationPatterns :: Maybe [Text]
enableAutoSubDomain :: Maybe Bool
$sel:subDomainSettings:UpdateDomainAssociation' :: UpdateDomainAssociation -> [SubDomainSetting]
$sel:domainName:UpdateDomainAssociation' :: UpdateDomainAssociation -> Text
$sel:appId:UpdateDomainAssociation' :: UpdateDomainAssociation -> Text
$sel:autoSubDomainIAMRole:UpdateDomainAssociation' :: UpdateDomainAssociation -> Maybe Text
$sel:autoSubDomainCreationPatterns:UpdateDomainAssociation' :: UpdateDomainAssociation -> Maybe [Text]
$sel:enableAutoSubDomain:UpdateDomainAssociation' :: UpdateDomainAssociation -> Maybe Bool
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/apps/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
appId,
        ByteString
"/domains/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
domainName
      ]

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

-- | The result structure for the update domain association request.
--
-- /See:/ 'newUpdateDomainAssociationResponse' smart constructor.
data UpdateDomainAssociationResponse = UpdateDomainAssociationResponse'
  { -- | The response's http status code.
    UpdateDomainAssociationResponse -> Int
httpStatus :: Prelude.Int,
    -- | Describes a domain association, which associates a custom domain with an
    -- Amplify app.
    UpdateDomainAssociationResponse -> DomainAssociation
domainAssociation :: DomainAssociation
  }
  deriving (UpdateDomainAssociationResponse
-> UpdateDomainAssociationResponse -> Bool
(UpdateDomainAssociationResponse
 -> UpdateDomainAssociationResponse -> Bool)
-> (UpdateDomainAssociationResponse
    -> UpdateDomainAssociationResponse -> Bool)
-> Eq UpdateDomainAssociationResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateDomainAssociationResponse
-> UpdateDomainAssociationResponse -> Bool
$c/= :: UpdateDomainAssociationResponse
-> UpdateDomainAssociationResponse -> Bool
== :: UpdateDomainAssociationResponse
-> UpdateDomainAssociationResponse -> Bool
$c== :: UpdateDomainAssociationResponse
-> UpdateDomainAssociationResponse -> Bool
Prelude.Eq, ReadPrec [UpdateDomainAssociationResponse]
ReadPrec UpdateDomainAssociationResponse
Int -> ReadS UpdateDomainAssociationResponse
ReadS [UpdateDomainAssociationResponse]
(Int -> ReadS UpdateDomainAssociationResponse)
-> ReadS [UpdateDomainAssociationResponse]
-> ReadPrec UpdateDomainAssociationResponse
-> ReadPrec [UpdateDomainAssociationResponse]
-> Read UpdateDomainAssociationResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateDomainAssociationResponse]
$creadListPrec :: ReadPrec [UpdateDomainAssociationResponse]
readPrec :: ReadPrec UpdateDomainAssociationResponse
$creadPrec :: ReadPrec UpdateDomainAssociationResponse
readList :: ReadS [UpdateDomainAssociationResponse]
$creadList :: ReadS [UpdateDomainAssociationResponse]
readsPrec :: Int -> ReadS UpdateDomainAssociationResponse
$creadsPrec :: Int -> ReadS UpdateDomainAssociationResponse
Prelude.Read, Int -> UpdateDomainAssociationResponse -> ShowS
[UpdateDomainAssociationResponse] -> ShowS
UpdateDomainAssociationResponse -> String
(Int -> UpdateDomainAssociationResponse -> ShowS)
-> (UpdateDomainAssociationResponse -> String)
-> ([UpdateDomainAssociationResponse] -> ShowS)
-> Show UpdateDomainAssociationResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateDomainAssociationResponse] -> ShowS
$cshowList :: [UpdateDomainAssociationResponse] -> ShowS
show :: UpdateDomainAssociationResponse -> String
$cshow :: UpdateDomainAssociationResponse -> String
showsPrec :: Int -> UpdateDomainAssociationResponse -> ShowS
$cshowsPrec :: Int -> UpdateDomainAssociationResponse -> ShowS
Prelude.Show, (forall x.
 UpdateDomainAssociationResponse
 -> Rep UpdateDomainAssociationResponse x)
-> (forall x.
    Rep UpdateDomainAssociationResponse x
    -> UpdateDomainAssociationResponse)
-> Generic UpdateDomainAssociationResponse
forall x.
Rep UpdateDomainAssociationResponse x
-> UpdateDomainAssociationResponse
forall x.
UpdateDomainAssociationResponse
-> Rep UpdateDomainAssociationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateDomainAssociationResponse x
-> UpdateDomainAssociationResponse
$cfrom :: forall x.
UpdateDomainAssociationResponse
-> Rep UpdateDomainAssociationResponse x
Prelude.Generic)

-- |
-- Create a value of 'UpdateDomainAssociationResponse' 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', 'updateDomainAssociationResponse_httpStatus' - The response's http status code.
--
-- 'domainAssociation', 'updateDomainAssociationResponse_domainAssociation' - Describes a domain association, which associates a custom domain with an
-- Amplify app.
newUpdateDomainAssociationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'domainAssociation'
  DomainAssociation ->
  UpdateDomainAssociationResponse
newUpdateDomainAssociationResponse :: Int -> DomainAssociation -> UpdateDomainAssociationResponse
newUpdateDomainAssociationResponse
  Int
pHttpStatus_
  DomainAssociation
pDomainAssociation_ =
    UpdateDomainAssociationResponse' :: Int -> DomainAssociation -> UpdateDomainAssociationResponse
UpdateDomainAssociationResponse'
      { $sel:httpStatus:UpdateDomainAssociationResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:domainAssociation:UpdateDomainAssociationResponse' :: DomainAssociation
domainAssociation = DomainAssociation
pDomainAssociation_
      }

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

-- | Describes a domain association, which associates a custom domain with an
-- Amplify app.
updateDomainAssociationResponse_domainAssociation :: Lens.Lens' UpdateDomainAssociationResponse DomainAssociation
updateDomainAssociationResponse_domainAssociation :: (DomainAssociation -> f DomainAssociation)
-> UpdateDomainAssociationResponse
-> f UpdateDomainAssociationResponse
updateDomainAssociationResponse_domainAssociation = (UpdateDomainAssociationResponse -> DomainAssociation)
-> (UpdateDomainAssociationResponse
    -> DomainAssociation -> UpdateDomainAssociationResponse)
-> Lens
     UpdateDomainAssociationResponse
     UpdateDomainAssociationResponse
     DomainAssociation
     DomainAssociation
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDomainAssociationResponse' {DomainAssociation
domainAssociation :: DomainAssociation
$sel:domainAssociation:UpdateDomainAssociationResponse' :: UpdateDomainAssociationResponse -> DomainAssociation
domainAssociation} -> DomainAssociation
domainAssociation) (\s :: UpdateDomainAssociationResponse
s@UpdateDomainAssociationResponse' {} DomainAssociation
a -> UpdateDomainAssociationResponse
s {$sel:domainAssociation:UpdateDomainAssociationResponse' :: DomainAssociation
domainAssociation = DomainAssociation
a} :: UpdateDomainAssociationResponse)

instance
  Prelude.NFData
    UpdateDomainAssociationResponse