{-# 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.CloudWatchEvents.CreateApiDestination
-- 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 an API destination, which is an HTTP invocation endpoint
-- configured as a target for events.
module Amazonka.CloudWatchEvents.CreateApiDestination
  ( -- * Creating a Request
    CreateApiDestination (..),
    newCreateApiDestination,

    -- * Request Lenses
    createApiDestination_invocationRateLimitPerSecond,
    createApiDestination_description,
    createApiDestination_name,
    createApiDestination_connectionArn,
    createApiDestination_invocationEndpoint,
    createApiDestination_httpMethod,

    -- * Destructuring the Response
    CreateApiDestinationResponse (..),
    newCreateApiDestinationResponse,

    -- * Response Lenses
    createApiDestinationResponse_creationTime,
    createApiDestinationResponse_lastModifiedTime,
    createApiDestinationResponse_apiDestinationState,
    createApiDestinationResponse_apiDestinationArn,
    createApiDestinationResponse_httpStatus,
  )
where

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

-- | /See:/ 'newCreateApiDestination' smart constructor.
data CreateApiDestination = CreateApiDestination'
  { -- | The maximum number of requests per second to send to the HTTP invocation
    -- endpoint.
    CreateApiDestination -> Maybe Natural
invocationRateLimitPerSecond :: Prelude.Maybe Prelude.Natural,
    -- | A description for the API destination to create.
    CreateApiDestination -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The name for the API destination to create.
    CreateApiDestination -> Text
name :: Prelude.Text,
    -- | The ARN of the connection to use for the API destination. The
    -- destination endpoint must support the authorization type specified for
    -- the connection.
    CreateApiDestination -> Text
connectionArn :: Prelude.Text,
    -- | The URL to the HTTP invocation endpoint for the API destination.
    CreateApiDestination -> Text
invocationEndpoint :: Prelude.Text,
    -- | The method to use for the request to the HTTP invocation endpoint.
    CreateApiDestination -> ApiDestinationHttpMethod
httpMethod :: ApiDestinationHttpMethod
  }
  deriving (CreateApiDestination -> CreateApiDestination -> Bool
(CreateApiDestination -> CreateApiDestination -> Bool)
-> (CreateApiDestination -> CreateApiDestination -> Bool)
-> Eq CreateApiDestination
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateApiDestination -> CreateApiDestination -> Bool
$c/= :: CreateApiDestination -> CreateApiDestination -> Bool
== :: CreateApiDestination -> CreateApiDestination -> Bool
$c== :: CreateApiDestination -> CreateApiDestination -> Bool
Prelude.Eq, ReadPrec [CreateApiDestination]
ReadPrec CreateApiDestination
Int -> ReadS CreateApiDestination
ReadS [CreateApiDestination]
(Int -> ReadS CreateApiDestination)
-> ReadS [CreateApiDestination]
-> ReadPrec CreateApiDestination
-> ReadPrec [CreateApiDestination]
-> Read CreateApiDestination
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateApiDestination]
$creadListPrec :: ReadPrec [CreateApiDestination]
readPrec :: ReadPrec CreateApiDestination
$creadPrec :: ReadPrec CreateApiDestination
readList :: ReadS [CreateApiDestination]
$creadList :: ReadS [CreateApiDestination]
readsPrec :: Int -> ReadS CreateApiDestination
$creadsPrec :: Int -> ReadS CreateApiDestination
Prelude.Read, Int -> CreateApiDestination -> ShowS
[CreateApiDestination] -> ShowS
CreateApiDestination -> String
(Int -> CreateApiDestination -> ShowS)
-> (CreateApiDestination -> String)
-> ([CreateApiDestination] -> ShowS)
-> Show CreateApiDestination
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateApiDestination] -> ShowS
$cshowList :: [CreateApiDestination] -> ShowS
show :: CreateApiDestination -> String
$cshow :: CreateApiDestination -> String
showsPrec :: Int -> CreateApiDestination -> ShowS
$cshowsPrec :: Int -> CreateApiDestination -> ShowS
Prelude.Show, (forall x. CreateApiDestination -> Rep CreateApiDestination x)
-> (forall x. Rep CreateApiDestination x -> CreateApiDestination)
-> Generic CreateApiDestination
forall x. Rep CreateApiDestination x -> CreateApiDestination
forall x. CreateApiDestination -> Rep CreateApiDestination x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateApiDestination x -> CreateApiDestination
$cfrom :: forall x. CreateApiDestination -> Rep CreateApiDestination x
Prelude.Generic)

-- |
-- Create a value of 'CreateApiDestination' 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:
--
-- 'invocationRateLimitPerSecond', 'createApiDestination_invocationRateLimitPerSecond' - The maximum number of requests per second to send to the HTTP invocation
-- endpoint.
--
-- 'description', 'createApiDestination_description' - A description for the API destination to create.
--
-- 'name', 'createApiDestination_name' - The name for the API destination to create.
--
-- 'connectionArn', 'createApiDestination_connectionArn' - The ARN of the connection to use for the API destination. The
-- destination endpoint must support the authorization type specified for
-- the connection.
--
-- 'invocationEndpoint', 'createApiDestination_invocationEndpoint' - The URL to the HTTP invocation endpoint for the API destination.
--
-- 'httpMethod', 'createApiDestination_httpMethod' - The method to use for the request to the HTTP invocation endpoint.
newCreateApiDestination ::
  -- | 'name'
  Prelude.Text ->
  -- | 'connectionArn'
  Prelude.Text ->
  -- | 'invocationEndpoint'
  Prelude.Text ->
  -- | 'httpMethod'
  ApiDestinationHttpMethod ->
  CreateApiDestination
newCreateApiDestination :: Text
-> Text -> Text -> ApiDestinationHttpMethod -> CreateApiDestination
newCreateApiDestination
  Text
pName_
  Text
pConnectionArn_
  Text
pInvocationEndpoint_
  ApiDestinationHttpMethod
pHttpMethod_ =
    CreateApiDestination' :: Maybe Natural
-> Maybe Text
-> Text
-> Text
-> Text
-> ApiDestinationHttpMethod
-> CreateApiDestination
CreateApiDestination'
      { $sel:invocationRateLimitPerSecond:CreateApiDestination' :: Maybe Natural
invocationRateLimitPerSecond =
          Maybe Natural
forall a. Maybe a
Prelude.Nothing,
        $sel:description:CreateApiDestination' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:name:CreateApiDestination' :: Text
name = Text
pName_,
        $sel:connectionArn:CreateApiDestination' :: Text
connectionArn = Text
pConnectionArn_,
        $sel:invocationEndpoint:CreateApiDestination' :: Text
invocationEndpoint = Text
pInvocationEndpoint_,
        $sel:httpMethod:CreateApiDestination' :: ApiDestinationHttpMethod
httpMethod = ApiDestinationHttpMethod
pHttpMethod_
      }

-- | The maximum number of requests per second to send to the HTTP invocation
-- endpoint.
createApiDestination_invocationRateLimitPerSecond :: Lens.Lens' CreateApiDestination (Prelude.Maybe Prelude.Natural)
createApiDestination_invocationRateLimitPerSecond :: (Maybe Natural -> f (Maybe Natural))
-> CreateApiDestination -> f CreateApiDestination
createApiDestination_invocationRateLimitPerSecond = (CreateApiDestination -> Maybe Natural)
-> (CreateApiDestination -> Maybe Natural -> CreateApiDestination)
-> Lens
     CreateApiDestination
     CreateApiDestination
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApiDestination' {Maybe Natural
invocationRateLimitPerSecond :: Maybe Natural
$sel:invocationRateLimitPerSecond:CreateApiDestination' :: CreateApiDestination -> Maybe Natural
invocationRateLimitPerSecond} -> Maybe Natural
invocationRateLimitPerSecond) (\s :: CreateApiDestination
s@CreateApiDestination' {} Maybe Natural
a -> CreateApiDestination
s {$sel:invocationRateLimitPerSecond:CreateApiDestination' :: Maybe Natural
invocationRateLimitPerSecond = Maybe Natural
a} :: CreateApiDestination)

-- | A description for the API destination to create.
createApiDestination_description :: Lens.Lens' CreateApiDestination (Prelude.Maybe Prelude.Text)
createApiDestination_description :: (Maybe Text -> f (Maybe Text))
-> CreateApiDestination -> f CreateApiDestination
createApiDestination_description = (CreateApiDestination -> Maybe Text)
-> (CreateApiDestination -> Maybe Text -> CreateApiDestination)
-> Lens
     CreateApiDestination CreateApiDestination (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApiDestination' {Maybe Text
description :: Maybe Text
$sel:description:CreateApiDestination' :: CreateApiDestination -> Maybe Text
description} -> Maybe Text
description) (\s :: CreateApiDestination
s@CreateApiDestination' {} Maybe Text
a -> CreateApiDestination
s {$sel:description:CreateApiDestination' :: Maybe Text
description = Maybe Text
a} :: CreateApiDestination)

-- | The name for the API destination to create.
createApiDestination_name :: Lens.Lens' CreateApiDestination Prelude.Text
createApiDestination_name :: (Text -> f Text) -> CreateApiDestination -> f CreateApiDestination
createApiDestination_name = (CreateApiDestination -> Text)
-> (CreateApiDestination -> Text -> CreateApiDestination)
-> Lens CreateApiDestination CreateApiDestination Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApiDestination' {Text
name :: Text
$sel:name:CreateApiDestination' :: CreateApiDestination -> Text
name} -> Text
name) (\s :: CreateApiDestination
s@CreateApiDestination' {} Text
a -> CreateApiDestination
s {$sel:name:CreateApiDestination' :: Text
name = Text
a} :: CreateApiDestination)

-- | The ARN of the connection to use for the API destination. The
-- destination endpoint must support the authorization type specified for
-- the connection.
createApiDestination_connectionArn :: Lens.Lens' CreateApiDestination Prelude.Text
createApiDestination_connectionArn :: (Text -> f Text) -> CreateApiDestination -> f CreateApiDestination
createApiDestination_connectionArn = (CreateApiDestination -> Text)
-> (CreateApiDestination -> Text -> CreateApiDestination)
-> Lens CreateApiDestination CreateApiDestination Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApiDestination' {Text
connectionArn :: Text
$sel:connectionArn:CreateApiDestination' :: CreateApiDestination -> Text
connectionArn} -> Text
connectionArn) (\s :: CreateApiDestination
s@CreateApiDestination' {} Text
a -> CreateApiDestination
s {$sel:connectionArn:CreateApiDestination' :: Text
connectionArn = Text
a} :: CreateApiDestination)

-- | The URL to the HTTP invocation endpoint for the API destination.
createApiDestination_invocationEndpoint :: Lens.Lens' CreateApiDestination Prelude.Text
createApiDestination_invocationEndpoint :: (Text -> f Text) -> CreateApiDestination -> f CreateApiDestination
createApiDestination_invocationEndpoint = (CreateApiDestination -> Text)
-> (CreateApiDestination -> Text -> CreateApiDestination)
-> Lens CreateApiDestination CreateApiDestination Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApiDestination' {Text
invocationEndpoint :: Text
$sel:invocationEndpoint:CreateApiDestination' :: CreateApiDestination -> Text
invocationEndpoint} -> Text
invocationEndpoint) (\s :: CreateApiDestination
s@CreateApiDestination' {} Text
a -> CreateApiDestination
s {$sel:invocationEndpoint:CreateApiDestination' :: Text
invocationEndpoint = Text
a} :: CreateApiDestination)

-- | The method to use for the request to the HTTP invocation endpoint.
createApiDestination_httpMethod :: Lens.Lens' CreateApiDestination ApiDestinationHttpMethod
createApiDestination_httpMethod :: (ApiDestinationHttpMethod -> f ApiDestinationHttpMethod)
-> CreateApiDestination -> f CreateApiDestination
createApiDestination_httpMethod = (CreateApiDestination -> ApiDestinationHttpMethod)
-> (CreateApiDestination
    -> ApiDestinationHttpMethod -> CreateApiDestination)
-> Lens
     CreateApiDestination
     CreateApiDestination
     ApiDestinationHttpMethod
     ApiDestinationHttpMethod
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApiDestination' {ApiDestinationHttpMethod
httpMethod :: ApiDestinationHttpMethod
$sel:httpMethod:CreateApiDestination' :: CreateApiDestination -> ApiDestinationHttpMethod
httpMethod} -> ApiDestinationHttpMethod
httpMethod) (\s :: CreateApiDestination
s@CreateApiDestination' {} ApiDestinationHttpMethod
a -> CreateApiDestination
s {$sel:httpMethod:CreateApiDestination' :: ApiDestinationHttpMethod
httpMethod = ApiDestinationHttpMethod
a} :: CreateApiDestination)

instance Core.AWSRequest CreateApiDestination where
  type
    AWSResponse CreateApiDestination =
      CreateApiDestinationResponse
  request :: CreateApiDestination -> Request CreateApiDestination
request = Service -> CreateApiDestination -> Request CreateApiDestination
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateApiDestination
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateApiDestination)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateApiDestination))
-> Logger
-> Service
-> Proxy CreateApiDestination
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateApiDestination)))
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 POSIX
-> Maybe POSIX
-> Maybe ApiDestinationState
-> Maybe Text
-> Int
-> CreateApiDestinationResponse
CreateApiDestinationResponse'
            (Maybe POSIX
 -> Maybe POSIX
 -> Maybe ApiDestinationState
 -> Maybe Text
 -> Int
 -> CreateApiDestinationResponse)
-> Either String (Maybe POSIX)
-> Either
     String
     (Maybe POSIX
      -> Maybe ApiDestinationState
      -> Maybe Text
      -> Int
      -> CreateApiDestinationResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"CreationTime")
            Either
  String
  (Maybe POSIX
   -> Maybe ApiDestinationState
   -> Maybe Text
   -> Int
   -> CreateApiDestinationResponse)
-> Either String (Maybe POSIX)
-> Either
     String
     (Maybe ApiDestinationState
      -> Maybe Text -> Int -> CreateApiDestinationResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"LastModifiedTime")
            Either
  String
  (Maybe ApiDestinationState
   -> Maybe Text -> Int -> CreateApiDestinationResponse)
-> Either String (Maybe ApiDestinationState)
-> Either
     String (Maybe Text -> Int -> CreateApiDestinationResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe ApiDestinationState)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ApiDestinationState")
            Either String (Maybe Text -> Int -> CreateApiDestinationResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateApiDestinationResponse)
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
"ApiDestinationArn")
            Either String (Int -> CreateApiDestinationResponse)
-> Either String Int -> Either String CreateApiDestinationResponse
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 CreateApiDestination

instance Prelude.NFData CreateApiDestination

instance Core.ToHeaders CreateApiDestination where
  toHeaders :: CreateApiDestination -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateApiDestination -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AWSEvents.CreateApiDestination" ::
                          Prelude.ByteString
                      ),
            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 CreateApiDestination where
  toJSON :: CreateApiDestination -> Value
toJSON CreateApiDestination' {Maybe Natural
Maybe Text
Text
ApiDestinationHttpMethod
httpMethod :: ApiDestinationHttpMethod
invocationEndpoint :: Text
connectionArn :: Text
name :: Text
description :: Maybe Text
invocationRateLimitPerSecond :: Maybe Natural
$sel:httpMethod:CreateApiDestination' :: CreateApiDestination -> ApiDestinationHttpMethod
$sel:invocationEndpoint:CreateApiDestination' :: CreateApiDestination -> Text
$sel:connectionArn:CreateApiDestination' :: CreateApiDestination -> Text
$sel:name:CreateApiDestination' :: CreateApiDestination -> Text
$sel:description:CreateApiDestination' :: CreateApiDestination -> Maybe Text
$sel:invocationRateLimitPerSecond:CreateApiDestination' :: CreateApiDestination -> Maybe Natural
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"InvocationRateLimitPerSecond" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
invocationRateLimitPerSecond,
            (Text
"Description" 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
description,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ConnectionArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
connectionArn),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"InvocationEndpoint" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
invocationEndpoint),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"HttpMethod" Text -> ApiDestinationHttpMethod -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ApiDestinationHttpMethod
httpMethod)
          ]
      )

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

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

-- | /See:/ 'newCreateApiDestinationResponse' smart constructor.
data CreateApiDestinationResponse = CreateApiDestinationResponse'
  { -- | A time stamp indicating the time that the API destination was created.
    CreateApiDestinationResponse -> Maybe POSIX
creationTime :: Prelude.Maybe Core.POSIX,
    -- | A time stamp indicating the time that the API destination was last
    -- modified.
    CreateApiDestinationResponse -> Maybe POSIX
lastModifiedTime :: Prelude.Maybe Core.POSIX,
    -- | The state of the API destination that was created by the request.
    CreateApiDestinationResponse -> Maybe ApiDestinationState
apiDestinationState :: Prelude.Maybe ApiDestinationState,
    -- | The ARN of the API destination that was created by the request.
    CreateApiDestinationResponse -> Maybe Text
apiDestinationArn :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    CreateApiDestinationResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateApiDestinationResponse
-> CreateApiDestinationResponse -> Bool
(CreateApiDestinationResponse
 -> CreateApiDestinationResponse -> Bool)
-> (CreateApiDestinationResponse
    -> CreateApiDestinationResponse -> Bool)
-> Eq CreateApiDestinationResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateApiDestinationResponse
-> CreateApiDestinationResponse -> Bool
$c/= :: CreateApiDestinationResponse
-> CreateApiDestinationResponse -> Bool
== :: CreateApiDestinationResponse
-> CreateApiDestinationResponse -> Bool
$c== :: CreateApiDestinationResponse
-> CreateApiDestinationResponse -> Bool
Prelude.Eq, ReadPrec [CreateApiDestinationResponse]
ReadPrec CreateApiDestinationResponse
Int -> ReadS CreateApiDestinationResponse
ReadS [CreateApiDestinationResponse]
(Int -> ReadS CreateApiDestinationResponse)
-> ReadS [CreateApiDestinationResponse]
-> ReadPrec CreateApiDestinationResponse
-> ReadPrec [CreateApiDestinationResponse]
-> Read CreateApiDestinationResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateApiDestinationResponse]
$creadListPrec :: ReadPrec [CreateApiDestinationResponse]
readPrec :: ReadPrec CreateApiDestinationResponse
$creadPrec :: ReadPrec CreateApiDestinationResponse
readList :: ReadS [CreateApiDestinationResponse]
$creadList :: ReadS [CreateApiDestinationResponse]
readsPrec :: Int -> ReadS CreateApiDestinationResponse
$creadsPrec :: Int -> ReadS CreateApiDestinationResponse
Prelude.Read, Int -> CreateApiDestinationResponse -> ShowS
[CreateApiDestinationResponse] -> ShowS
CreateApiDestinationResponse -> String
(Int -> CreateApiDestinationResponse -> ShowS)
-> (CreateApiDestinationResponse -> String)
-> ([CreateApiDestinationResponse] -> ShowS)
-> Show CreateApiDestinationResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateApiDestinationResponse] -> ShowS
$cshowList :: [CreateApiDestinationResponse] -> ShowS
show :: CreateApiDestinationResponse -> String
$cshow :: CreateApiDestinationResponse -> String
showsPrec :: Int -> CreateApiDestinationResponse -> ShowS
$cshowsPrec :: Int -> CreateApiDestinationResponse -> ShowS
Prelude.Show, (forall x.
 CreateApiDestinationResponse -> Rep CreateApiDestinationResponse x)
-> (forall x.
    Rep CreateApiDestinationResponse x -> CreateApiDestinationResponse)
-> Generic CreateApiDestinationResponse
forall x.
Rep CreateApiDestinationResponse x -> CreateApiDestinationResponse
forall x.
CreateApiDestinationResponse -> Rep CreateApiDestinationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateApiDestinationResponse x -> CreateApiDestinationResponse
$cfrom :: forall x.
CreateApiDestinationResponse -> Rep CreateApiDestinationResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateApiDestinationResponse' 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:
--
-- 'creationTime', 'createApiDestinationResponse_creationTime' - A time stamp indicating the time that the API destination was created.
--
-- 'lastModifiedTime', 'createApiDestinationResponse_lastModifiedTime' - A time stamp indicating the time that the API destination was last
-- modified.
--
-- 'apiDestinationState', 'createApiDestinationResponse_apiDestinationState' - The state of the API destination that was created by the request.
--
-- 'apiDestinationArn', 'createApiDestinationResponse_apiDestinationArn' - The ARN of the API destination that was created by the request.
--
-- 'httpStatus', 'createApiDestinationResponse_httpStatus' - The response's http status code.
newCreateApiDestinationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateApiDestinationResponse
newCreateApiDestinationResponse :: Int -> CreateApiDestinationResponse
newCreateApiDestinationResponse Int
pHttpStatus_ =
  CreateApiDestinationResponse' :: Maybe POSIX
-> Maybe POSIX
-> Maybe ApiDestinationState
-> Maybe Text
-> Int
-> CreateApiDestinationResponse
CreateApiDestinationResponse'
    { $sel:creationTime:CreateApiDestinationResponse' :: Maybe POSIX
creationTime =
        Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:lastModifiedTime:CreateApiDestinationResponse' :: Maybe POSIX
lastModifiedTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:apiDestinationState:CreateApiDestinationResponse' :: Maybe ApiDestinationState
apiDestinationState = Maybe ApiDestinationState
forall a. Maybe a
Prelude.Nothing,
      $sel:apiDestinationArn:CreateApiDestinationResponse' :: Maybe Text
apiDestinationArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateApiDestinationResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A time stamp indicating the time that the API destination was created.
createApiDestinationResponse_creationTime :: Lens.Lens' CreateApiDestinationResponse (Prelude.Maybe Prelude.UTCTime)
createApiDestinationResponse_creationTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> CreateApiDestinationResponse -> f CreateApiDestinationResponse
createApiDestinationResponse_creationTime = (CreateApiDestinationResponse -> Maybe POSIX)
-> (CreateApiDestinationResponse
    -> Maybe POSIX -> CreateApiDestinationResponse)
-> Lens
     CreateApiDestinationResponse
     CreateApiDestinationResponse
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApiDestinationResponse' {Maybe POSIX
creationTime :: Maybe POSIX
$sel:creationTime:CreateApiDestinationResponse' :: CreateApiDestinationResponse -> Maybe POSIX
creationTime} -> Maybe POSIX
creationTime) (\s :: CreateApiDestinationResponse
s@CreateApiDestinationResponse' {} Maybe POSIX
a -> CreateApiDestinationResponse
s {$sel:creationTime:CreateApiDestinationResponse' :: Maybe POSIX
creationTime = Maybe POSIX
a} :: CreateApiDestinationResponse) ((Maybe POSIX -> f (Maybe POSIX))
 -> CreateApiDestinationResponse -> f CreateApiDestinationResponse)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> CreateApiDestinationResponse
-> f CreateApiDestinationResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | A time stamp indicating the time that the API destination was last
-- modified.
createApiDestinationResponse_lastModifiedTime :: Lens.Lens' CreateApiDestinationResponse (Prelude.Maybe Prelude.UTCTime)
createApiDestinationResponse_lastModifiedTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> CreateApiDestinationResponse -> f CreateApiDestinationResponse
createApiDestinationResponse_lastModifiedTime = (CreateApiDestinationResponse -> Maybe POSIX)
-> (CreateApiDestinationResponse
    -> Maybe POSIX -> CreateApiDestinationResponse)
-> Lens
     CreateApiDestinationResponse
     CreateApiDestinationResponse
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApiDestinationResponse' {Maybe POSIX
lastModifiedTime :: Maybe POSIX
$sel:lastModifiedTime:CreateApiDestinationResponse' :: CreateApiDestinationResponse -> Maybe POSIX
lastModifiedTime} -> Maybe POSIX
lastModifiedTime) (\s :: CreateApiDestinationResponse
s@CreateApiDestinationResponse' {} Maybe POSIX
a -> CreateApiDestinationResponse
s {$sel:lastModifiedTime:CreateApiDestinationResponse' :: Maybe POSIX
lastModifiedTime = Maybe POSIX
a} :: CreateApiDestinationResponse) ((Maybe POSIX -> f (Maybe POSIX))
 -> CreateApiDestinationResponse -> f CreateApiDestinationResponse)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> CreateApiDestinationResponse
-> f CreateApiDestinationResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The state of the API destination that was created by the request.
createApiDestinationResponse_apiDestinationState :: Lens.Lens' CreateApiDestinationResponse (Prelude.Maybe ApiDestinationState)
createApiDestinationResponse_apiDestinationState :: (Maybe ApiDestinationState -> f (Maybe ApiDestinationState))
-> CreateApiDestinationResponse -> f CreateApiDestinationResponse
createApiDestinationResponse_apiDestinationState = (CreateApiDestinationResponse -> Maybe ApiDestinationState)
-> (CreateApiDestinationResponse
    -> Maybe ApiDestinationState -> CreateApiDestinationResponse)
-> Lens
     CreateApiDestinationResponse
     CreateApiDestinationResponse
     (Maybe ApiDestinationState)
     (Maybe ApiDestinationState)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApiDestinationResponse' {Maybe ApiDestinationState
apiDestinationState :: Maybe ApiDestinationState
$sel:apiDestinationState:CreateApiDestinationResponse' :: CreateApiDestinationResponse -> Maybe ApiDestinationState
apiDestinationState} -> Maybe ApiDestinationState
apiDestinationState) (\s :: CreateApiDestinationResponse
s@CreateApiDestinationResponse' {} Maybe ApiDestinationState
a -> CreateApiDestinationResponse
s {$sel:apiDestinationState:CreateApiDestinationResponse' :: Maybe ApiDestinationState
apiDestinationState = Maybe ApiDestinationState
a} :: CreateApiDestinationResponse)

-- | The ARN of the API destination that was created by the request.
createApiDestinationResponse_apiDestinationArn :: Lens.Lens' CreateApiDestinationResponse (Prelude.Maybe Prelude.Text)
createApiDestinationResponse_apiDestinationArn :: (Maybe Text -> f (Maybe Text))
-> CreateApiDestinationResponse -> f CreateApiDestinationResponse
createApiDestinationResponse_apiDestinationArn = (CreateApiDestinationResponse -> Maybe Text)
-> (CreateApiDestinationResponse
    -> Maybe Text -> CreateApiDestinationResponse)
-> Lens
     CreateApiDestinationResponse
     CreateApiDestinationResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApiDestinationResponse' {Maybe Text
apiDestinationArn :: Maybe Text
$sel:apiDestinationArn:CreateApiDestinationResponse' :: CreateApiDestinationResponse -> Maybe Text
apiDestinationArn} -> Maybe Text
apiDestinationArn) (\s :: CreateApiDestinationResponse
s@CreateApiDestinationResponse' {} Maybe Text
a -> CreateApiDestinationResponse
s {$sel:apiDestinationArn:CreateApiDestinationResponse' :: Maybe Text
apiDestinationArn = Maybe Text
a} :: CreateApiDestinationResponse)

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

instance Prelude.NFData CreateApiDestinationResponse