{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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_description,
    createApiDestination_invocationRateLimitPerSecond,
    createApiDestination_name,
    createApiDestination_connectionArn,
    createApiDestination_invocationEndpoint,
    createApiDestination_httpMethod,

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

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

import Amazonka.CloudWatchEvents.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:/ 'newCreateApiDestination' smart constructor.
data CreateApiDestination = CreateApiDestination'
  { -- | A description for the API destination to create.
    CreateApiDestination -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of requests per second to send to the HTTP invocation
    -- endpoint.
    CreateApiDestination -> Maybe Natural
invocationRateLimitPerSecond :: Prelude.Maybe Prelude.Natural,
    -- | 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
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]
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
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. 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:
--
-- 'description', 'createApiDestination_description' - A description for the API destination to create.
--
-- 'invocationRateLimitPerSecond', 'createApiDestination_invocationRateLimitPerSecond' - The maximum number of requests per second to send to the HTTP invocation
-- endpoint.
--
-- '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'
      { $sel:description:CreateApiDestination' :: Maybe Text
description =
          forall a. Maybe a
Prelude.Nothing,
        $sel:invocationRateLimitPerSecond:CreateApiDestination' :: Maybe Natural
invocationRateLimitPerSecond = 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_
      }

-- | A description for the API destination to create.
createApiDestination_description :: Lens.Lens' CreateApiDestination (Prelude.Maybe Prelude.Text)
createApiDestination_description :: Lens' CreateApiDestination (Maybe Text)
createApiDestination_description = 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 maximum number of requests per second to send to the HTTP invocation
-- endpoint.
createApiDestination_invocationRateLimitPerSecond :: Lens.Lens' CreateApiDestination (Prelude.Maybe Prelude.Natural)
createApiDestination_invocationRateLimitPerSecond :: Lens' CreateApiDestination (Maybe Natural)
createApiDestination_invocationRateLimitPerSecond = 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)

-- | The name for the API destination to create.
createApiDestination_name :: Lens.Lens' CreateApiDestination Prelude.Text
createApiDestination_name :: Lens' CreateApiDestination Text
createApiDestination_name = 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 :: Lens' CreateApiDestination Text
createApiDestination_connectionArn = 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 :: Lens' CreateApiDestination Text
createApiDestination_invocationEndpoint = 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 :: Lens' CreateApiDestination ApiDestinationHttpMethod
createApiDestination_httpMethod = 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 :: (Service -> Service)
-> CreateApiDestination -> Request CreateApiDestination
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateApiDestination
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateApiDestination)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text
-> Maybe ApiDestinationState
-> Maybe POSIX
-> Maybe POSIX
-> Int
-> CreateApiDestinationResponse
CreateApiDestinationResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"ApiDestinationArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"ApiDestinationState")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"CreationTime")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"LastModifiedTime")
            forall (f :: * -> *) a b. Applicative f => 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 CreateApiDestination where
  hashWithSalt :: Int -> CreateApiDestination -> Int
hashWithSalt Int
_salt CreateApiDestination' {Maybe Natural
Maybe Text
Text
ApiDestinationHttpMethod
httpMethod :: ApiDestinationHttpMethod
invocationEndpoint :: Text
connectionArn :: Text
name :: Text
invocationRateLimitPerSecond :: Maybe Natural
description :: Maybe Text
$sel:httpMethod:CreateApiDestination' :: CreateApiDestination -> ApiDestinationHttpMethod
$sel:invocationEndpoint:CreateApiDestination' :: CreateApiDestination -> Text
$sel:connectionArn:CreateApiDestination' :: CreateApiDestination -> Text
$sel:name:CreateApiDestination' :: CreateApiDestination -> Text
$sel:invocationRateLimitPerSecond:CreateApiDestination' :: CreateApiDestination -> Maybe Natural
$sel:description:CreateApiDestination' :: CreateApiDestination -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
invocationRateLimitPerSecond
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
connectionArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
invocationEndpoint
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ApiDestinationHttpMethod
httpMethod

instance Prelude.NFData CreateApiDestination where
  rnf :: CreateApiDestination -> ()
rnf CreateApiDestination' {Maybe Natural
Maybe Text
Text
ApiDestinationHttpMethod
httpMethod :: ApiDestinationHttpMethod
invocationEndpoint :: Text
connectionArn :: Text
name :: Text
invocationRateLimitPerSecond :: Maybe Natural
description :: Maybe Text
$sel:httpMethod:CreateApiDestination' :: CreateApiDestination -> ApiDestinationHttpMethod
$sel:invocationEndpoint:CreateApiDestination' :: CreateApiDestination -> Text
$sel:connectionArn:CreateApiDestination' :: CreateApiDestination -> Text
$sel:name:CreateApiDestination' :: CreateApiDestination -> Text
$sel:invocationRateLimitPerSecond:CreateApiDestination' :: CreateApiDestination -> Maybe Natural
$sel:description:CreateApiDestination' :: CreateApiDestination -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
invocationRateLimitPerSecond
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
connectionArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
invocationEndpoint
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ApiDestinationHttpMethod
httpMethod

instance Data.ToHeaders CreateApiDestination where
  toHeaders :: CreateApiDestination -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"AWSEvents.CreateApiDestination" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON CreateApiDestination where
  toJSON :: CreateApiDestination -> Value
toJSON CreateApiDestination' {Maybe Natural
Maybe Text
Text
ApiDestinationHttpMethod
httpMethod :: ApiDestinationHttpMethod
invocationEndpoint :: Text
connectionArn :: Text
name :: Text
invocationRateLimitPerSecond :: Maybe Natural
description :: Maybe Text
$sel:httpMethod:CreateApiDestination' :: CreateApiDestination -> ApiDestinationHttpMethod
$sel:invocationEndpoint:CreateApiDestination' :: CreateApiDestination -> Text
$sel:connectionArn:CreateApiDestination' :: CreateApiDestination -> Text
$sel:name:CreateApiDestination' :: CreateApiDestination -> Text
$sel:invocationRateLimitPerSecond:CreateApiDestination' :: CreateApiDestination -> Maybe Natural
$sel:description:CreateApiDestination' :: CreateApiDestination -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"Description" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
description,
            (Key
"InvocationRateLimitPerSecond" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
invocationRateLimitPerSecond,
            forall a. a -> Maybe a
Prelude.Just (Key
"Name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name),
            forall a. a -> Maybe a
Prelude.Just (Key
"ConnectionArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
connectionArn),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"InvocationEndpoint" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
invocationEndpoint),
            forall a. a -> Maybe a
Prelude.Just (Key
"HttpMethod" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= ApiDestinationHttpMethod
httpMethod)
          ]
      )

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

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

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

-- | The ARN of the API destination that was created by the request.
createApiDestinationResponse_apiDestinationArn :: Lens.Lens' CreateApiDestinationResponse (Prelude.Maybe Prelude.Text)
createApiDestinationResponse_apiDestinationArn :: Lens' CreateApiDestinationResponse (Maybe Text)
createApiDestinationResponse_apiDestinationArn = 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 state of the API destination that was created by the request.
createApiDestinationResponse_apiDestinationState :: Lens.Lens' CreateApiDestinationResponse (Prelude.Maybe ApiDestinationState)
createApiDestinationResponse_apiDestinationState :: Lens' CreateApiDestinationResponse (Maybe ApiDestinationState)
createApiDestinationResponse_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)

-- | A time stamp indicating the time that the API destination was created.
createApiDestinationResponse_creationTime :: Lens.Lens' CreateApiDestinationResponse (Prelude.Maybe Prelude.UTCTime)
createApiDestinationResponse_creationTime :: Lens' CreateApiDestinationResponse (Maybe UTCTime)
createApiDestinationResponse_creationTime = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._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 :: Lens' CreateApiDestinationResponse (Maybe UTCTime)
createApiDestinationResponse_lastModifiedTime = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The response's http status code.
createApiDestinationResponse_httpStatus :: Lens.Lens' CreateApiDestinationResponse Prelude.Int
createApiDestinationResponse_httpStatus :: Lens' CreateApiDestinationResponse Int
createApiDestinationResponse_httpStatus = 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 where
  rnf :: CreateApiDestinationResponse -> ()
rnf CreateApiDestinationResponse' {Int
Maybe Text
Maybe POSIX
Maybe ApiDestinationState
httpStatus :: Int
lastModifiedTime :: Maybe POSIX
creationTime :: Maybe POSIX
apiDestinationState :: Maybe ApiDestinationState
apiDestinationArn :: Maybe Text
$sel:httpStatus:CreateApiDestinationResponse' :: CreateApiDestinationResponse -> Int
$sel:lastModifiedTime:CreateApiDestinationResponse' :: CreateApiDestinationResponse -> Maybe POSIX
$sel:creationTime:CreateApiDestinationResponse' :: CreateApiDestinationResponse -> Maybe POSIX
$sel:apiDestinationState:CreateApiDestinationResponse' :: CreateApiDestinationResponse -> Maybe ApiDestinationState
$sel:apiDestinationArn:CreateApiDestinationResponse' :: CreateApiDestinationResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
apiDestinationArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ApiDestinationState
apiDestinationState
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
creationTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
lastModifiedTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus