{-# 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.SetTypeDefaultVersion
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Specify the default version of an extension. The default version of an
-- extension will be used in CloudFormation operations.
module Amazonka.CloudFormation.SetTypeDefaultVersion
  ( -- * Creating a Request
    SetTypeDefaultVersion (..),
    newSetTypeDefaultVersion,

    -- * Request Lenses
    setTypeDefaultVersion_arn,
    setTypeDefaultVersion_type,
    setTypeDefaultVersion_typeName,
    setTypeDefaultVersion_versionId,

    -- * Destructuring the Response
    SetTypeDefaultVersionResponse (..),
    newSetTypeDefaultVersionResponse,

    -- * Response Lenses
    setTypeDefaultVersionResponse_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:/ 'newSetTypeDefaultVersion' smart constructor.
data SetTypeDefaultVersion = SetTypeDefaultVersion'
  { -- | The Amazon Resource Name (ARN) of the extension for which you want
    -- version summary information.
    --
    -- Conditional: You must specify either @TypeName@ and @Type@, or @Arn@.
    SetTypeDefaultVersion -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The kind of extension.
    --
    -- Conditional: You must specify either @TypeName@ and @Type@, or @Arn@.
    SetTypeDefaultVersion -> Maybe RegistryType
type' :: Prelude.Maybe RegistryType,
    -- | The name of the extension.
    --
    -- Conditional: You must specify either @TypeName@ and @Type@, or @Arn@.
    SetTypeDefaultVersion -> Maybe Text
typeName :: Prelude.Maybe Prelude.Text,
    -- | The ID of a specific version of the extension. The version ID is the
    -- value at the end of the Amazon Resource Name (ARN) assigned to the
    -- extension version when it is registered.
    SetTypeDefaultVersion -> Maybe Text
versionId :: Prelude.Maybe Prelude.Text
  }
  deriving (SetTypeDefaultVersion -> SetTypeDefaultVersion -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SetTypeDefaultVersion -> SetTypeDefaultVersion -> Bool
$c/= :: SetTypeDefaultVersion -> SetTypeDefaultVersion -> Bool
== :: SetTypeDefaultVersion -> SetTypeDefaultVersion -> Bool
$c== :: SetTypeDefaultVersion -> SetTypeDefaultVersion -> Bool
Prelude.Eq, ReadPrec [SetTypeDefaultVersion]
ReadPrec SetTypeDefaultVersion
Int -> ReadS SetTypeDefaultVersion
ReadS [SetTypeDefaultVersion]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SetTypeDefaultVersion]
$creadListPrec :: ReadPrec [SetTypeDefaultVersion]
readPrec :: ReadPrec SetTypeDefaultVersion
$creadPrec :: ReadPrec SetTypeDefaultVersion
readList :: ReadS [SetTypeDefaultVersion]
$creadList :: ReadS [SetTypeDefaultVersion]
readsPrec :: Int -> ReadS SetTypeDefaultVersion
$creadsPrec :: Int -> ReadS SetTypeDefaultVersion
Prelude.Read, Int -> SetTypeDefaultVersion -> ShowS
[SetTypeDefaultVersion] -> ShowS
SetTypeDefaultVersion -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SetTypeDefaultVersion] -> ShowS
$cshowList :: [SetTypeDefaultVersion] -> ShowS
show :: SetTypeDefaultVersion -> String
$cshow :: SetTypeDefaultVersion -> String
showsPrec :: Int -> SetTypeDefaultVersion -> ShowS
$cshowsPrec :: Int -> SetTypeDefaultVersion -> ShowS
Prelude.Show, forall x. Rep SetTypeDefaultVersion x -> SetTypeDefaultVersion
forall x. SetTypeDefaultVersion -> Rep SetTypeDefaultVersion x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SetTypeDefaultVersion x -> SetTypeDefaultVersion
$cfrom :: forall x. SetTypeDefaultVersion -> Rep SetTypeDefaultVersion x
Prelude.Generic)

-- |
-- Create a value of 'SetTypeDefaultVersion' 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:
--
-- 'arn', 'setTypeDefaultVersion_arn' - The Amazon Resource Name (ARN) of the extension for which you want
-- version summary information.
--
-- Conditional: You must specify either @TypeName@ and @Type@, or @Arn@.
--
-- 'type'', 'setTypeDefaultVersion_type' - The kind of extension.
--
-- Conditional: You must specify either @TypeName@ and @Type@, or @Arn@.
--
-- 'typeName', 'setTypeDefaultVersion_typeName' - The name of the extension.
--
-- Conditional: You must specify either @TypeName@ and @Type@, or @Arn@.
--
-- 'versionId', 'setTypeDefaultVersion_versionId' - The ID of a specific version of the extension. The version ID is the
-- value at the end of the Amazon Resource Name (ARN) assigned to the
-- extension version when it is registered.
newSetTypeDefaultVersion ::
  SetTypeDefaultVersion
newSetTypeDefaultVersion :: SetTypeDefaultVersion
newSetTypeDefaultVersion =
  SetTypeDefaultVersion'
    { $sel:arn:SetTypeDefaultVersion' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:type':SetTypeDefaultVersion' :: Maybe RegistryType
type' = forall a. Maybe a
Prelude.Nothing,
      $sel:typeName:SetTypeDefaultVersion' :: Maybe Text
typeName = forall a. Maybe a
Prelude.Nothing,
      $sel:versionId:SetTypeDefaultVersion' :: Maybe Text
versionId = forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name (ARN) of the extension for which you want
-- version summary information.
--
-- Conditional: You must specify either @TypeName@ and @Type@, or @Arn@.
setTypeDefaultVersion_arn :: Lens.Lens' SetTypeDefaultVersion (Prelude.Maybe Prelude.Text)
setTypeDefaultVersion_arn :: Lens' SetTypeDefaultVersion (Maybe Text)
setTypeDefaultVersion_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetTypeDefaultVersion' {Maybe Text
arn :: Maybe Text
$sel:arn:SetTypeDefaultVersion' :: SetTypeDefaultVersion -> Maybe Text
arn} -> Maybe Text
arn) (\s :: SetTypeDefaultVersion
s@SetTypeDefaultVersion' {} Maybe Text
a -> SetTypeDefaultVersion
s {$sel:arn:SetTypeDefaultVersion' :: Maybe Text
arn = Maybe Text
a} :: SetTypeDefaultVersion)

-- | The kind of extension.
--
-- Conditional: You must specify either @TypeName@ and @Type@, or @Arn@.
setTypeDefaultVersion_type :: Lens.Lens' SetTypeDefaultVersion (Prelude.Maybe RegistryType)
setTypeDefaultVersion_type :: Lens' SetTypeDefaultVersion (Maybe RegistryType)
setTypeDefaultVersion_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetTypeDefaultVersion' {Maybe RegistryType
type' :: Maybe RegistryType
$sel:type':SetTypeDefaultVersion' :: SetTypeDefaultVersion -> Maybe RegistryType
type'} -> Maybe RegistryType
type') (\s :: SetTypeDefaultVersion
s@SetTypeDefaultVersion' {} Maybe RegistryType
a -> SetTypeDefaultVersion
s {$sel:type':SetTypeDefaultVersion' :: Maybe RegistryType
type' = Maybe RegistryType
a} :: SetTypeDefaultVersion)

-- | The name of the extension.
--
-- Conditional: You must specify either @TypeName@ and @Type@, or @Arn@.
setTypeDefaultVersion_typeName :: Lens.Lens' SetTypeDefaultVersion (Prelude.Maybe Prelude.Text)
setTypeDefaultVersion_typeName :: Lens' SetTypeDefaultVersion (Maybe Text)
setTypeDefaultVersion_typeName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetTypeDefaultVersion' {Maybe Text
typeName :: Maybe Text
$sel:typeName:SetTypeDefaultVersion' :: SetTypeDefaultVersion -> Maybe Text
typeName} -> Maybe Text
typeName) (\s :: SetTypeDefaultVersion
s@SetTypeDefaultVersion' {} Maybe Text
a -> SetTypeDefaultVersion
s {$sel:typeName:SetTypeDefaultVersion' :: Maybe Text
typeName = Maybe Text
a} :: SetTypeDefaultVersion)

-- | The ID of a specific version of the extension. The version ID is the
-- value at the end of the Amazon Resource Name (ARN) assigned to the
-- extension version when it is registered.
setTypeDefaultVersion_versionId :: Lens.Lens' SetTypeDefaultVersion (Prelude.Maybe Prelude.Text)
setTypeDefaultVersion_versionId :: Lens' SetTypeDefaultVersion (Maybe Text)
setTypeDefaultVersion_versionId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetTypeDefaultVersion' {Maybe Text
versionId :: Maybe Text
$sel:versionId:SetTypeDefaultVersion' :: SetTypeDefaultVersion -> Maybe Text
versionId} -> Maybe Text
versionId) (\s :: SetTypeDefaultVersion
s@SetTypeDefaultVersion' {} Maybe Text
a -> SetTypeDefaultVersion
s {$sel:versionId:SetTypeDefaultVersion' :: Maybe Text
versionId = Maybe Text
a} :: SetTypeDefaultVersion)

instance Core.AWSRequest SetTypeDefaultVersion where
  type
    AWSResponse SetTypeDefaultVersion =
      SetTypeDefaultVersionResponse
  request :: (Service -> Service)
-> SetTypeDefaultVersion -> Request SetTypeDefaultVersion
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 SetTypeDefaultVersion
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse SetTypeDefaultVersion)))
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
"SetTypeDefaultVersionResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Int -> SetTypeDefaultVersionResponse
SetTypeDefaultVersionResponse'
            forall (f :: * -> *) a b. Functor 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 SetTypeDefaultVersion where
  hashWithSalt :: Int -> SetTypeDefaultVersion -> Int
hashWithSalt Int
_salt SetTypeDefaultVersion' {Maybe Text
Maybe RegistryType
versionId :: Maybe Text
typeName :: Maybe Text
type' :: Maybe RegistryType
arn :: Maybe Text
$sel:versionId:SetTypeDefaultVersion' :: SetTypeDefaultVersion -> Maybe Text
$sel:typeName:SetTypeDefaultVersion' :: SetTypeDefaultVersion -> Maybe Text
$sel:type':SetTypeDefaultVersion' :: SetTypeDefaultVersion -> Maybe RegistryType
$sel:arn:SetTypeDefaultVersion' :: SetTypeDefaultVersion -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
arn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe RegistryType
type'
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
typeName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
versionId

instance Prelude.NFData SetTypeDefaultVersion where
  rnf :: SetTypeDefaultVersion -> ()
rnf SetTypeDefaultVersion' {Maybe Text
Maybe RegistryType
versionId :: Maybe Text
typeName :: Maybe Text
type' :: Maybe RegistryType
arn :: Maybe Text
$sel:versionId:SetTypeDefaultVersion' :: SetTypeDefaultVersion -> Maybe Text
$sel:typeName:SetTypeDefaultVersion' :: SetTypeDefaultVersion -> Maybe Text
$sel:type':SetTypeDefaultVersion' :: SetTypeDefaultVersion -> Maybe RegistryType
$sel:arn:SetTypeDefaultVersion' :: SetTypeDefaultVersion -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe RegistryType
type'
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
typeName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
versionId

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

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

instance Data.ToQuery SetTypeDefaultVersion where
  toQuery :: SetTypeDefaultVersion -> QueryString
toQuery SetTypeDefaultVersion' {Maybe Text
Maybe RegistryType
versionId :: Maybe Text
typeName :: Maybe Text
type' :: Maybe RegistryType
arn :: Maybe Text
$sel:versionId:SetTypeDefaultVersion' :: SetTypeDefaultVersion -> Maybe Text
$sel:typeName:SetTypeDefaultVersion' :: SetTypeDefaultVersion -> Maybe Text
$sel:type':SetTypeDefaultVersion' :: SetTypeDefaultVersion -> Maybe RegistryType
$sel:arn:SetTypeDefaultVersion' :: SetTypeDefaultVersion -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"SetTypeDefaultVersion" :: Prelude.ByteString),
        ByteString
"Version"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2010-05-15" :: Prelude.ByteString),
        ByteString
"Arn" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
arn,
        ByteString
"Type" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe RegistryType
type',
        ByteString
"TypeName" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
typeName,
        ByteString
"VersionId" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
versionId
      ]

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

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

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

instance Prelude.NFData SetTypeDefaultVersionResponse where
  rnf :: SetTypeDefaultVersionResponse -> ()
rnf SetTypeDefaultVersionResponse' {Int
httpStatus :: Int
$sel:httpStatus:SetTypeDefaultVersionResponse' :: SetTypeDefaultVersionResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus