{-# 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.Greengrass.CreateSubscriptionDefinition
-- 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 subscription definition. You may provide the initial version
-- of the subscription definition now or use
-- \'\'CreateSubscriptionDefinitionVersion\'\' at a later time.
module Amazonka.Greengrass.CreateSubscriptionDefinition
  ( -- * Creating a Request
    CreateSubscriptionDefinition (..),
    newCreateSubscriptionDefinition,

    -- * Request Lenses
    createSubscriptionDefinition_amznClientToken,
    createSubscriptionDefinition_initialVersion,
    createSubscriptionDefinition_name,
    createSubscriptionDefinition_tags,

    -- * Destructuring the Response
    CreateSubscriptionDefinitionResponse (..),
    newCreateSubscriptionDefinitionResponse,

    -- * Response Lenses
    createSubscriptionDefinitionResponse_latestVersionArn,
    createSubscriptionDefinitionResponse_arn,
    createSubscriptionDefinitionResponse_name,
    createSubscriptionDefinitionResponse_creationTimestamp,
    createSubscriptionDefinitionResponse_id,
    createSubscriptionDefinitionResponse_latestVersion,
    createSubscriptionDefinitionResponse_lastUpdatedTimestamp,
    createSubscriptionDefinitionResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.Greengrass.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newCreateSubscriptionDefinition' smart constructor.
data CreateSubscriptionDefinition = CreateSubscriptionDefinition'
  { -- | A client token used to correlate requests and responses.
    CreateSubscriptionDefinition -> Maybe Text
amznClientToken :: Prelude.Maybe Prelude.Text,
    -- | Information about the initial version of the subscription definition.
    CreateSubscriptionDefinition -> Maybe SubscriptionDefinitionVersion
initialVersion :: Prelude.Maybe SubscriptionDefinitionVersion,
    -- | The name of the subscription definition.
    CreateSubscriptionDefinition -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | Tag(s) to add to the new resource.
    CreateSubscriptionDefinition -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text)
  }
  deriving (CreateSubscriptionDefinition
-> CreateSubscriptionDefinition -> Bool
(CreateSubscriptionDefinition
 -> CreateSubscriptionDefinition -> Bool)
-> (CreateSubscriptionDefinition
    -> CreateSubscriptionDefinition -> Bool)
-> Eq CreateSubscriptionDefinition
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateSubscriptionDefinition
-> CreateSubscriptionDefinition -> Bool
$c/= :: CreateSubscriptionDefinition
-> CreateSubscriptionDefinition -> Bool
== :: CreateSubscriptionDefinition
-> CreateSubscriptionDefinition -> Bool
$c== :: CreateSubscriptionDefinition
-> CreateSubscriptionDefinition -> Bool
Prelude.Eq, ReadPrec [CreateSubscriptionDefinition]
ReadPrec CreateSubscriptionDefinition
Int -> ReadS CreateSubscriptionDefinition
ReadS [CreateSubscriptionDefinition]
(Int -> ReadS CreateSubscriptionDefinition)
-> ReadS [CreateSubscriptionDefinition]
-> ReadPrec CreateSubscriptionDefinition
-> ReadPrec [CreateSubscriptionDefinition]
-> Read CreateSubscriptionDefinition
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateSubscriptionDefinition]
$creadListPrec :: ReadPrec [CreateSubscriptionDefinition]
readPrec :: ReadPrec CreateSubscriptionDefinition
$creadPrec :: ReadPrec CreateSubscriptionDefinition
readList :: ReadS [CreateSubscriptionDefinition]
$creadList :: ReadS [CreateSubscriptionDefinition]
readsPrec :: Int -> ReadS CreateSubscriptionDefinition
$creadsPrec :: Int -> ReadS CreateSubscriptionDefinition
Prelude.Read, Int -> CreateSubscriptionDefinition -> ShowS
[CreateSubscriptionDefinition] -> ShowS
CreateSubscriptionDefinition -> String
(Int -> CreateSubscriptionDefinition -> ShowS)
-> (CreateSubscriptionDefinition -> String)
-> ([CreateSubscriptionDefinition] -> ShowS)
-> Show CreateSubscriptionDefinition
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateSubscriptionDefinition] -> ShowS
$cshowList :: [CreateSubscriptionDefinition] -> ShowS
show :: CreateSubscriptionDefinition -> String
$cshow :: CreateSubscriptionDefinition -> String
showsPrec :: Int -> CreateSubscriptionDefinition -> ShowS
$cshowsPrec :: Int -> CreateSubscriptionDefinition -> ShowS
Prelude.Show, (forall x.
 CreateSubscriptionDefinition -> Rep CreateSubscriptionDefinition x)
-> (forall x.
    Rep CreateSubscriptionDefinition x -> CreateSubscriptionDefinition)
-> Generic CreateSubscriptionDefinition
forall x.
Rep CreateSubscriptionDefinition x -> CreateSubscriptionDefinition
forall x.
CreateSubscriptionDefinition -> Rep CreateSubscriptionDefinition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateSubscriptionDefinition x -> CreateSubscriptionDefinition
$cfrom :: forall x.
CreateSubscriptionDefinition -> Rep CreateSubscriptionDefinition x
Prelude.Generic)

-- |
-- Create a value of 'CreateSubscriptionDefinition' 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:
--
-- 'amznClientToken', 'createSubscriptionDefinition_amznClientToken' - A client token used to correlate requests and responses.
--
-- 'initialVersion', 'createSubscriptionDefinition_initialVersion' - Information about the initial version of the subscription definition.
--
-- 'name', 'createSubscriptionDefinition_name' - The name of the subscription definition.
--
-- 'tags', 'createSubscriptionDefinition_tags' - Tag(s) to add to the new resource.
newCreateSubscriptionDefinition ::
  CreateSubscriptionDefinition
newCreateSubscriptionDefinition :: CreateSubscriptionDefinition
newCreateSubscriptionDefinition =
  CreateSubscriptionDefinition' :: Maybe Text
-> Maybe SubscriptionDefinitionVersion
-> Maybe Text
-> Maybe (HashMap Text Text)
-> CreateSubscriptionDefinition
CreateSubscriptionDefinition'
    { $sel:amznClientToken:CreateSubscriptionDefinition' :: Maybe Text
amznClientToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:initialVersion:CreateSubscriptionDefinition' :: Maybe SubscriptionDefinitionVersion
initialVersion = Maybe SubscriptionDefinitionVersion
forall a. Maybe a
Prelude.Nothing,
      $sel:name:CreateSubscriptionDefinition' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:CreateSubscriptionDefinition' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing
    }

-- | A client token used to correlate requests and responses.
createSubscriptionDefinition_amznClientToken :: Lens.Lens' CreateSubscriptionDefinition (Prelude.Maybe Prelude.Text)
createSubscriptionDefinition_amznClientToken :: (Maybe Text -> f (Maybe Text))
-> CreateSubscriptionDefinition -> f CreateSubscriptionDefinition
createSubscriptionDefinition_amznClientToken = (CreateSubscriptionDefinition -> Maybe Text)
-> (CreateSubscriptionDefinition
    -> Maybe Text -> CreateSubscriptionDefinition)
-> Lens
     CreateSubscriptionDefinition
     CreateSubscriptionDefinition
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSubscriptionDefinition' {Maybe Text
amznClientToken :: Maybe Text
$sel:amznClientToken:CreateSubscriptionDefinition' :: CreateSubscriptionDefinition -> Maybe Text
amznClientToken} -> Maybe Text
amznClientToken) (\s :: CreateSubscriptionDefinition
s@CreateSubscriptionDefinition' {} Maybe Text
a -> CreateSubscriptionDefinition
s {$sel:amznClientToken:CreateSubscriptionDefinition' :: Maybe Text
amznClientToken = Maybe Text
a} :: CreateSubscriptionDefinition)

-- | Information about the initial version of the subscription definition.
createSubscriptionDefinition_initialVersion :: Lens.Lens' CreateSubscriptionDefinition (Prelude.Maybe SubscriptionDefinitionVersion)
createSubscriptionDefinition_initialVersion :: (Maybe SubscriptionDefinitionVersion
 -> f (Maybe SubscriptionDefinitionVersion))
-> CreateSubscriptionDefinition -> f CreateSubscriptionDefinition
createSubscriptionDefinition_initialVersion = (CreateSubscriptionDefinition
 -> Maybe SubscriptionDefinitionVersion)
-> (CreateSubscriptionDefinition
    -> Maybe SubscriptionDefinitionVersion
    -> CreateSubscriptionDefinition)
-> Lens
     CreateSubscriptionDefinition
     CreateSubscriptionDefinition
     (Maybe SubscriptionDefinitionVersion)
     (Maybe SubscriptionDefinitionVersion)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSubscriptionDefinition' {Maybe SubscriptionDefinitionVersion
initialVersion :: Maybe SubscriptionDefinitionVersion
$sel:initialVersion:CreateSubscriptionDefinition' :: CreateSubscriptionDefinition -> Maybe SubscriptionDefinitionVersion
initialVersion} -> Maybe SubscriptionDefinitionVersion
initialVersion) (\s :: CreateSubscriptionDefinition
s@CreateSubscriptionDefinition' {} Maybe SubscriptionDefinitionVersion
a -> CreateSubscriptionDefinition
s {$sel:initialVersion:CreateSubscriptionDefinition' :: Maybe SubscriptionDefinitionVersion
initialVersion = Maybe SubscriptionDefinitionVersion
a} :: CreateSubscriptionDefinition)

-- | The name of the subscription definition.
createSubscriptionDefinition_name :: Lens.Lens' CreateSubscriptionDefinition (Prelude.Maybe Prelude.Text)
createSubscriptionDefinition_name :: (Maybe Text -> f (Maybe Text))
-> CreateSubscriptionDefinition -> f CreateSubscriptionDefinition
createSubscriptionDefinition_name = (CreateSubscriptionDefinition -> Maybe Text)
-> (CreateSubscriptionDefinition
    -> Maybe Text -> CreateSubscriptionDefinition)
-> Lens
     CreateSubscriptionDefinition
     CreateSubscriptionDefinition
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSubscriptionDefinition' {Maybe Text
name :: Maybe Text
$sel:name:CreateSubscriptionDefinition' :: CreateSubscriptionDefinition -> Maybe Text
name} -> Maybe Text
name) (\s :: CreateSubscriptionDefinition
s@CreateSubscriptionDefinition' {} Maybe Text
a -> CreateSubscriptionDefinition
s {$sel:name:CreateSubscriptionDefinition' :: Maybe Text
name = Maybe Text
a} :: CreateSubscriptionDefinition)

-- | Tag(s) to add to the new resource.
createSubscriptionDefinition_tags :: Lens.Lens' CreateSubscriptionDefinition (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createSubscriptionDefinition_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateSubscriptionDefinition -> f CreateSubscriptionDefinition
createSubscriptionDefinition_tags = (CreateSubscriptionDefinition -> Maybe (HashMap Text Text))
-> (CreateSubscriptionDefinition
    -> Maybe (HashMap Text Text) -> CreateSubscriptionDefinition)
-> Lens
     CreateSubscriptionDefinition
     CreateSubscriptionDefinition
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSubscriptionDefinition' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateSubscriptionDefinition' :: CreateSubscriptionDefinition -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateSubscriptionDefinition
s@CreateSubscriptionDefinition' {} Maybe (HashMap Text Text)
a -> CreateSubscriptionDefinition
s {$sel:tags:CreateSubscriptionDefinition' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateSubscriptionDefinition) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> CreateSubscriptionDefinition -> f CreateSubscriptionDefinition)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateSubscriptionDefinition
-> f CreateSubscriptionDefinition
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text 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
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.AWSRequest CreateSubscriptionDefinition where
  type
    AWSResponse CreateSubscriptionDefinition =
      CreateSubscriptionDefinitionResponse
  request :: CreateSubscriptionDefinition
-> Request CreateSubscriptionDefinition
request = Service
-> CreateSubscriptionDefinition
-> Request CreateSubscriptionDefinition
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateSubscriptionDefinition
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateSubscriptionDefinition)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateSubscriptionDefinition))
-> Logger
-> Service
-> Proxy CreateSubscriptionDefinition
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateSubscriptionDefinition)))
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 ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Int
-> CreateSubscriptionDefinitionResponse
CreateSubscriptionDefinitionResponse'
            (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Int
 -> CreateSubscriptionDefinitionResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Int
      -> CreateSubscriptionDefinitionResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"LatestVersionArn")
            Either
  String
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Int
   -> CreateSubscriptionDefinitionResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Int
      -> CreateSubscriptionDefinitionResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Arn")
            Either
  String
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Int
   -> CreateSubscriptionDefinitionResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Int
      -> CreateSubscriptionDefinitionResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Name")
            Either
  String
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Int
   -> CreateSubscriptionDefinitionResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Int
      -> CreateSubscriptionDefinitionResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"CreationTimestamp")
            Either
  String
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Int
   -> CreateSubscriptionDefinitionResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text -> Int -> CreateSubscriptionDefinitionResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Id")
            Either
  String
  (Maybe Text
   -> Maybe Text -> Int -> CreateSubscriptionDefinitionResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe Text -> Int -> CreateSubscriptionDefinitionResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"LatestVersion")
            Either
  String (Maybe Text -> Int -> CreateSubscriptionDefinitionResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateSubscriptionDefinitionResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"LastUpdatedTimestamp")
            Either String (Int -> CreateSubscriptionDefinitionResponse)
-> Either String Int
-> Either String CreateSubscriptionDefinitionResponse
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))
      )

instance
  Prelude.Hashable
    CreateSubscriptionDefinition

instance Prelude.NFData CreateSubscriptionDefinition

instance Core.ToHeaders CreateSubscriptionDefinition where
  toHeaders :: CreateSubscriptionDefinition -> ResponseHeaders
toHeaders CreateSubscriptionDefinition' {Maybe Text
Maybe (HashMap Text Text)
Maybe SubscriptionDefinitionVersion
tags :: Maybe (HashMap Text Text)
name :: Maybe Text
initialVersion :: Maybe SubscriptionDefinitionVersion
amznClientToken :: Maybe Text
$sel:tags:CreateSubscriptionDefinition' :: CreateSubscriptionDefinition -> Maybe (HashMap Text Text)
$sel:name:CreateSubscriptionDefinition' :: CreateSubscriptionDefinition -> Maybe Text
$sel:initialVersion:CreateSubscriptionDefinition' :: CreateSubscriptionDefinition -> Maybe SubscriptionDefinitionVersion
$sel:amznClientToken:CreateSubscriptionDefinition' :: CreateSubscriptionDefinition -> Maybe Text
..} =
    [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ HeaderName
"X-Amzn-Client-Token" HeaderName -> Maybe Text -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# Maybe Text
amznClientToken,
        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 CreateSubscriptionDefinition where
  toJSON :: CreateSubscriptionDefinition -> Value
toJSON CreateSubscriptionDefinition' {Maybe Text
Maybe (HashMap Text Text)
Maybe SubscriptionDefinitionVersion
tags :: Maybe (HashMap Text Text)
name :: Maybe Text
initialVersion :: Maybe SubscriptionDefinitionVersion
amznClientToken :: Maybe Text
$sel:tags:CreateSubscriptionDefinition' :: CreateSubscriptionDefinition -> Maybe (HashMap Text Text)
$sel:name:CreateSubscriptionDefinition' :: CreateSubscriptionDefinition -> Maybe Text
$sel:initialVersion:CreateSubscriptionDefinition' :: CreateSubscriptionDefinition -> Maybe SubscriptionDefinitionVersion
$sel:amznClientToken:CreateSubscriptionDefinition' :: CreateSubscriptionDefinition -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"InitialVersion" Text -> SubscriptionDefinitionVersion -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (SubscriptionDefinitionVersion -> Pair)
-> Maybe SubscriptionDefinitionVersion -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SubscriptionDefinitionVersion
initialVersion,
            (Text
"Name" 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
name,
            (Text
"tags" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
tags
          ]
      )

instance Core.ToPath CreateSubscriptionDefinition where
  toPath :: CreateSubscriptionDefinition -> ByteString
toPath =
    ByteString -> CreateSubscriptionDefinition -> ByteString
forall a b. a -> b -> a
Prelude.const
      ByteString
"/greengrass/definition/subscriptions"

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

-- | /See:/ 'newCreateSubscriptionDefinitionResponse' smart constructor.
data CreateSubscriptionDefinitionResponse = CreateSubscriptionDefinitionResponse'
  { -- | The ARN of the latest version associated with the definition.
    CreateSubscriptionDefinitionResponse -> Maybe Text
latestVersionArn :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the definition.
    CreateSubscriptionDefinitionResponse -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The name of the definition.
    CreateSubscriptionDefinitionResponse -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The time, in milliseconds since the epoch, when the definition was
    -- created.
    CreateSubscriptionDefinitionResponse -> Maybe Text
creationTimestamp :: Prelude.Maybe Prelude.Text,
    -- | The ID of the definition.
    CreateSubscriptionDefinitionResponse -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | The ID of the latest version associated with the definition.
    CreateSubscriptionDefinitionResponse -> Maybe Text
latestVersion :: Prelude.Maybe Prelude.Text,
    -- | The time, in milliseconds since the epoch, when the definition was last
    -- updated.
    CreateSubscriptionDefinitionResponse -> Maybe Text
lastUpdatedTimestamp :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    CreateSubscriptionDefinitionResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateSubscriptionDefinitionResponse
-> CreateSubscriptionDefinitionResponse -> Bool
(CreateSubscriptionDefinitionResponse
 -> CreateSubscriptionDefinitionResponse -> Bool)
-> (CreateSubscriptionDefinitionResponse
    -> CreateSubscriptionDefinitionResponse -> Bool)
-> Eq CreateSubscriptionDefinitionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateSubscriptionDefinitionResponse
-> CreateSubscriptionDefinitionResponse -> Bool
$c/= :: CreateSubscriptionDefinitionResponse
-> CreateSubscriptionDefinitionResponse -> Bool
== :: CreateSubscriptionDefinitionResponse
-> CreateSubscriptionDefinitionResponse -> Bool
$c== :: CreateSubscriptionDefinitionResponse
-> CreateSubscriptionDefinitionResponse -> Bool
Prelude.Eq, ReadPrec [CreateSubscriptionDefinitionResponse]
ReadPrec CreateSubscriptionDefinitionResponse
Int -> ReadS CreateSubscriptionDefinitionResponse
ReadS [CreateSubscriptionDefinitionResponse]
(Int -> ReadS CreateSubscriptionDefinitionResponse)
-> ReadS [CreateSubscriptionDefinitionResponse]
-> ReadPrec CreateSubscriptionDefinitionResponse
-> ReadPrec [CreateSubscriptionDefinitionResponse]
-> Read CreateSubscriptionDefinitionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateSubscriptionDefinitionResponse]
$creadListPrec :: ReadPrec [CreateSubscriptionDefinitionResponse]
readPrec :: ReadPrec CreateSubscriptionDefinitionResponse
$creadPrec :: ReadPrec CreateSubscriptionDefinitionResponse
readList :: ReadS [CreateSubscriptionDefinitionResponse]
$creadList :: ReadS [CreateSubscriptionDefinitionResponse]
readsPrec :: Int -> ReadS CreateSubscriptionDefinitionResponse
$creadsPrec :: Int -> ReadS CreateSubscriptionDefinitionResponse
Prelude.Read, Int -> CreateSubscriptionDefinitionResponse -> ShowS
[CreateSubscriptionDefinitionResponse] -> ShowS
CreateSubscriptionDefinitionResponse -> String
(Int -> CreateSubscriptionDefinitionResponse -> ShowS)
-> (CreateSubscriptionDefinitionResponse -> String)
-> ([CreateSubscriptionDefinitionResponse] -> ShowS)
-> Show CreateSubscriptionDefinitionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateSubscriptionDefinitionResponse] -> ShowS
$cshowList :: [CreateSubscriptionDefinitionResponse] -> ShowS
show :: CreateSubscriptionDefinitionResponse -> String
$cshow :: CreateSubscriptionDefinitionResponse -> String
showsPrec :: Int -> CreateSubscriptionDefinitionResponse -> ShowS
$cshowsPrec :: Int -> CreateSubscriptionDefinitionResponse -> ShowS
Prelude.Show, (forall x.
 CreateSubscriptionDefinitionResponse
 -> Rep CreateSubscriptionDefinitionResponse x)
-> (forall x.
    Rep CreateSubscriptionDefinitionResponse x
    -> CreateSubscriptionDefinitionResponse)
-> Generic CreateSubscriptionDefinitionResponse
forall x.
Rep CreateSubscriptionDefinitionResponse x
-> CreateSubscriptionDefinitionResponse
forall x.
CreateSubscriptionDefinitionResponse
-> Rep CreateSubscriptionDefinitionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateSubscriptionDefinitionResponse x
-> CreateSubscriptionDefinitionResponse
$cfrom :: forall x.
CreateSubscriptionDefinitionResponse
-> Rep CreateSubscriptionDefinitionResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateSubscriptionDefinitionResponse' 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:
--
-- 'latestVersionArn', 'createSubscriptionDefinitionResponse_latestVersionArn' - The ARN of the latest version associated with the definition.
--
-- 'arn', 'createSubscriptionDefinitionResponse_arn' - The ARN of the definition.
--
-- 'name', 'createSubscriptionDefinitionResponse_name' - The name of the definition.
--
-- 'creationTimestamp', 'createSubscriptionDefinitionResponse_creationTimestamp' - The time, in milliseconds since the epoch, when the definition was
-- created.
--
-- 'id', 'createSubscriptionDefinitionResponse_id' - The ID of the definition.
--
-- 'latestVersion', 'createSubscriptionDefinitionResponse_latestVersion' - The ID of the latest version associated with the definition.
--
-- 'lastUpdatedTimestamp', 'createSubscriptionDefinitionResponse_lastUpdatedTimestamp' - The time, in milliseconds since the epoch, when the definition was last
-- updated.
--
-- 'httpStatus', 'createSubscriptionDefinitionResponse_httpStatus' - The response's http status code.
newCreateSubscriptionDefinitionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateSubscriptionDefinitionResponse
newCreateSubscriptionDefinitionResponse :: Int -> CreateSubscriptionDefinitionResponse
newCreateSubscriptionDefinitionResponse Int
pHttpStatus_ =
  CreateSubscriptionDefinitionResponse' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Int
-> CreateSubscriptionDefinitionResponse
CreateSubscriptionDefinitionResponse'
    { $sel:latestVersionArn:CreateSubscriptionDefinitionResponse' :: Maybe Text
latestVersionArn =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:arn:CreateSubscriptionDefinitionResponse' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:CreateSubscriptionDefinitionResponse' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:creationTimestamp:CreateSubscriptionDefinitionResponse' :: Maybe Text
creationTimestamp = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:id:CreateSubscriptionDefinitionResponse' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:latestVersion:CreateSubscriptionDefinitionResponse' :: Maybe Text
latestVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdatedTimestamp:CreateSubscriptionDefinitionResponse' :: Maybe Text
lastUpdatedTimestamp =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateSubscriptionDefinitionResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The ARN of the latest version associated with the definition.
createSubscriptionDefinitionResponse_latestVersionArn :: Lens.Lens' CreateSubscriptionDefinitionResponse (Prelude.Maybe Prelude.Text)
createSubscriptionDefinitionResponse_latestVersionArn :: (Maybe Text -> f (Maybe Text))
-> CreateSubscriptionDefinitionResponse
-> f CreateSubscriptionDefinitionResponse
createSubscriptionDefinitionResponse_latestVersionArn = (CreateSubscriptionDefinitionResponse -> Maybe Text)
-> (CreateSubscriptionDefinitionResponse
    -> Maybe Text -> CreateSubscriptionDefinitionResponse)
-> Lens
     CreateSubscriptionDefinitionResponse
     CreateSubscriptionDefinitionResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSubscriptionDefinitionResponse' {Maybe Text
latestVersionArn :: Maybe Text
$sel:latestVersionArn:CreateSubscriptionDefinitionResponse' :: CreateSubscriptionDefinitionResponse -> Maybe Text
latestVersionArn} -> Maybe Text
latestVersionArn) (\s :: CreateSubscriptionDefinitionResponse
s@CreateSubscriptionDefinitionResponse' {} Maybe Text
a -> CreateSubscriptionDefinitionResponse
s {$sel:latestVersionArn:CreateSubscriptionDefinitionResponse' :: Maybe Text
latestVersionArn = Maybe Text
a} :: CreateSubscriptionDefinitionResponse)

-- | The ARN of the definition.
createSubscriptionDefinitionResponse_arn :: Lens.Lens' CreateSubscriptionDefinitionResponse (Prelude.Maybe Prelude.Text)
createSubscriptionDefinitionResponse_arn :: (Maybe Text -> f (Maybe Text))
-> CreateSubscriptionDefinitionResponse
-> f CreateSubscriptionDefinitionResponse
createSubscriptionDefinitionResponse_arn = (CreateSubscriptionDefinitionResponse -> Maybe Text)
-> (CreateSubscriptionDefinitionResponse
    -> Maybe Text -> CreateSubscriptionDefinitionResponse)
-> Lens
     CreateSubscriptionDefinitionResponse
     CreateSubscriptionDefinitionResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSubscriptionDefinitionResponse' {Maybe Text
arn :: Maybe Text
$sel:arn:CreateSubscriptionDefinitionResponse' :: CreateSubscriptionDefinitionResponse -> Maybe Text
arn} -> Maybe Text
arn) (\s :: CreateSubscriptionDefinitionResponse
s@CreateSubscriptionDefinitionResponse' {} Maybe Text
a -> CreateSubscriptionDefinitionResponse
s {$sel:arn:CreateSubscriptionDefinitionResponse' :: Maybe Text
arn = Maybe Text
a} :: CreateSubscriptionDefinitionResponse)

-- | The name of the definition.
createSubscriptionDefinitionResponse_name :: Lens.Lens' CreateSubscriptionDefinitionResponse (Prelude.Maybe Prelude.Text)
createSubscriptionDefinitionResponse_name :: (Maybe Text -> f (Maybe Text))
-> CreateSubscriptionDefinitionResponse
-> f CreateSubscriptionDefinitionResponse
createSubscriptionDefinitionResponse_name = (CreateSubscriptionDefinitionResponse -> Maybe Text)
-> (CreateSubscriptionDefinitionResponse
    -> Maybe Text -> CreateSubscriptionDefinitionResponse)
-> Lens
     CreateSubscriptionDefinitionResponse
     CreateSubscriptionDefinitionResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSubscriptionDefinitionResponse' {Maybe Text
name :: Maybe Text
$sel:name:CreateSubscriptionDefinitionResponse' :: CreateSubscriptionDefinitionResponse -> Maybe Text
name} -> Maybe Text
name) (\s :: CreateSubscriptionDefinitionResponse
s@CreateSubscriptionDefinitionResponse' {} Maybe Text
a -> CreateSubscriptionDefinitionResponse
s {$sel:name:CreateSubscriptionDefinitionResponse' :: Maybe Text
name = Maybe Text
a} :: CreateSubscriptionDefinitionResponse)

-- | The time, in milliseconds since the epoch, when the definition was
-- created.
createSubscriptionDefinitionResponse_creationTimestamp :: Lens.Lens' CreateSubscriptionDefinitionResponse (Prelude.Maybe Prelude.Text)
createSubscriptionDefinitionResponse_creationTimestamp :: (Maybe Text -> f (Maybe Text))
-> CreateSubscriptionDefinitionResponse
-> f CreateSubscriptionDefinitionResponse
createSubscriptionDefinitionResponse_creationTimestamp = (CreateSubscriptionDefinitionResponse -> Maybe Text)
-> (CreateSubscriptionDefinitionResponse
    -> Maybe Text -> CreateSubscriptionDefinitionResponse)
-> Lens
     CreateSubscriptionDefinitionResponse
     CreateSubscriptionDefinitionResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSubscriptionDefinitionResponse' {Maybe Text
creationTimestamp :: Maybe Text
$sel:creationTimestamp:CreateSubscriptionDefinitionResponse' :: CreateSubscriptionDefinitionResponse -> Maybe Text
creationTimestamp} -> Maybe Text
creationTimestamp) (\s :: CreateSubscriptionDefinitionResponse
s@CreateSubscriptionDefinitionResponse' {} Maybe Text
a -> CreateSubscriptionDefinitionResponse
s {$sel:creationTimestamp:CreateSubscriptionDefinitionResponse' :: Maybe Text
creationTimestamp = Maybe Text
a} :: CreateSubscriptionDefinitionResponse)

-- | The ID of the definition.
createSubscriptionDefinitionResponse_id :: Lens.Lens' CreateSubscriptionDefinitionResponse (Prelude.Maybe Prelude.Text)
createSubscriptionDefinitionResponse_id :: (Maybe Text -> f (Maybe Text))
-> CreateSubscriptionDefinitionResponse
-> f CreateSubscriptionDefinitionResponse
createSubscriptionDefinitionResponse_id = (CreateSubscriptionDefinitionResponse -> Maybe Text)
-> (CreateSubscriptionDefinitionResponse
    -> Maybe Text -> CreateSubscriptionDefinitionResponse)
-> Lens
     CreateSubscriptionDefinitionResponse
     CreateSubscriptionDefinitionResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSubscriptionDefinitionResponse' {Maybe Text
id :: Maybe Text
$sel:id:CreateSubscriptionDefinitionResponse' :: CreateSubscriptionDefinitionResponse -> Maybe Text
id} -> Maybe Text
id) (\s :: CreateSubscriptionDefinitionResponse
s@CreateSubscriptionDefinitionResponse' {} Maybe Text
a -> CreateSubscriptionDefinitionResponse
s {$sel:id:CreateSubscriptionDefinitionResponse' :: Maybe Text
id = Maybe Text
a} :: CreateSubscriptionDefinitionResponse)

-- | The ID of the latest version associated with the definition.
createSubscriptionDefinitionResponse_latestVersion :: Lens.Lens' CreateSubscriptionDefinitionResponse (Prelude.Maybe Prelude.Text)
createSubscriptionDefinitionResponse_latestVersion :: (Maybe Text -> f (Maybe Text))
-> CreateSubscriptionDefinitionResponse
-> f CreateSubscriptionDefinitionResponse
createSubscriptionDefinitionResponse_latestVersion = (CreateSubscriptionDefinitionResponse -> Maybe Text)
-> (CreateSubscriptionDefinitionResponse
    -> Maybe Text -> CreateSubscriptionDefinitionResponse)
-> Lens
     CreateSubscriptionDefinitionResponse
     CreateSubscriptionDefinitionResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSubscriptionDefinitionResponse' {Maybe Text
latestVersion :: Maybe Text
$sel:latestVersion:CreateSubscriptionDefinitionResponse' :: CreateSubscriptionDefinitionResponse -> Maybe Text
latestVersion} -> Maybe Text
latestVersion) (\s :: CreateSubscriptionDefinitionResponse
s@CreateSubscriptionDefinitionResponse' {} Maybe Text
a -> CreateSubscriptionDefinitionResponse
s {$sel:latestVersion:CreateSubscriptionDefinitionResponse' :: Maybe Text
latestVersion = Maybe Text
a} :: CreateSubscriptionDefinitionResponse)

-- | The time, in milliseconds since the epoch, when the definition was last
-- updated.
createSubscriptionDefinitionResponse_lastUpdatedTimestamp :: Lens.Lens' CreateSubscriptionDefinitionResponse (Prelude.Maybe Prelude.Text)
createSubscriptionDefinitionResponse_lastUpdatedTimestamp :: (Maybe Text -> f (Maybe Text))
-> CreateSubscriptionDefinitionResponse
-> f CreateSubscriptionDefinitionResponse
createSubscriptionDefinitionResponse_lastUpdatedTimestamp = (CreateSubscriptionDefinitionResponse -> Maybe Text)
-> (CreateSubscriptionDefinitionResponse
    -> Maybe Text -> CreateSubscriptionDefinitionResponse)
-> Lens
     CreateSubscriptionDefinitionResponse
     CreateSubscriptionDefinitionResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSubscriptionDefinitionResponse' {Maybe Text
lastUpdatedTimestamp :: Maybe Text
$sel:lastUpdatedTimestamp:CreateSubscriptionDefinitionResponse' :: CreateSubscriptionDefinitionResponse -> Maybe Text
lastUpdatedTimestamp} -> Maybe Text
lastUpdatedTimestamp) (\s :: CreateSubscriptionDefinitionResponse
s@CreateSubscriptionDefinitionResponse' {} Maybe Text
a -> CreateSubscriptionDefinitionResponse
s {$sel:lastUpdatedTimestamp:CreateSubscriptionDefinitionResponse' :: Maybe Text
lastUpdatedTimestamp = Maybe Text
a} :: CreateSubscriptionDefinitionResponse)

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

instance
  Prelude.NFData
    CreateSubscriptionDefinitionResponse