{-# 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.ImageBuilder.ImportComponent
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Imports a component and transforms its data into a component document.
module Amazonka.ImageBuilder.ImportComponent
  ( -- * Creating a Request
    ImportComponent (..),
    newImportComponent,

    -- * Request Lenses
    importComponent_changeDescription,
    importComponent_data,
    importComponent_description,
    importComponent_kmsKeyId,
    importComponent_tags,
    importComponent_uri,
    importComponent_name,
    importComponent_semanticVersion,
    importComponent_type,
    importComponent_format,
    importComponent_platform,
    importComponent_clientToken,

    -- * Destructuring the Response
    ImportComponentResponse (..),
    newImportComponentResponse,

    -- * Response Lenses
    importComponentResponse_clientToken,
    importComponentResponse_componentBuildVersionArn,
    importComponentResponse_requestId,
    importComponentResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.ImageBuilder.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newImportComponent' smart constructor.
data ImportComponent = ImportComponent'
  { -- | The change description of the component. Describes what change has been
    -- made in this version, or what makes this version different from other
    -- versions of this component.
    ImportComponent -> Maybe Text
changeDescription :: Prelude.Maybe Prelude.Text,
    -- | The data of the component. Used to specify the data inline. Either
    -- @data@ or @uri@ can be used to specify the data within the component.
    ImportComponent -> Maybe Text
data' :: Prelude.Maybe Prelude.Text,
    -- | The description of the component. Describes the contents of the
    -- component.
    ImportComponent -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The ID of the KMS key that should be used to encrypt this component.
    ImportComponent -> Maybe Text
kmsKeyId :: Prelude.Maybe Prelude.Text,
    -- | The tags of the component.
    ImportComponent -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The uri of the component. Must be an Amazon S3 URL and the requester
    -- must have permission to access the Amazon S3 bucket. If you use Amazon
    -- S3, you can specify component content up to your service quota. Either
    -- @data@ or @uri@ can be used to specify the data within the component.
    ImportComponent -> Maybe Text
uri :: Prelude.Maybe Prelude.Text,
    -- | The name of the component.
    ImportComponent -> Text
name :: Prelude.Text,
    -- | The semantic version of the component. This version follows the semantic
    -- version syntax.
    --
    -- The semantic version has four nodes:
    -- \<major>.\<minor>.\<patch>\/\<build>. You can assign values for the
    -- first three, and can filter on all of them.
    --
    -- __Filtering:__ With semantic versioning, you have the flexibility to use
    -- wildcards (x) to specify the most recent versions or nodes when
    -- selecting the base image or components for your recipe. When you use a
    -- wildcard in any node, all nodes to the right of the first wildcard must
    -- also be wildcards.
    ImportComponent -> Text
semanticVersion :: Prelude.Text,
    -- | The type of the component denotes whether the component is used to build
    -- the image, or only to test it.
    ImportComponent -> ComponentType
type' :: ComponentType,
    -- | The format of the resource that you want to import as a component.
    ImportComponent -> ComponentFormat
format :: ComponentFormat,
    -- | The platform of the component.
    ImportComponent -> Platform
platform :: Platform,
    -- | The idempotency token of the component.
    ImportComponent -> Text
clientToken :: Prelude.Text
  }
  deriving (ImportComponent -> ImportComponent -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ImportComponent -> ImportComponent -> Bool
$c/= :: ImportComponent -> ImportComponent -> Bool
== :: ImportComponent -> ImportComponent -> Bool
$c== :: ImportComponent -> ImportComponent -> Bool
Prelude.Eq, ReadPrec [ImportComponent]
ReadPrec ImportComponent
Int -> ReadS ImportComponent
ReadS [ImportComponent]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ImportComponent]
$creadListPrec :: ReadPrec [ImportComponent]
readPrec :: ReadPrec ImportComponent
$creadPrec :: ReadPrec ImportComponent
readList :: ReadS [ImportComponent]
$creadList :: ReadS [ImportComponent]
readsPrec :: Int -> ReadS ImportComponent
$creadsPrec :: Int -> ReadS ImportComponent
Prelude.Read, Int -> ImportComponent -> ShowS
[ImportComponent] -> ShowS
ImportComponent -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ImportComponent] -> ShowS
$cshowList :: [ImportComponent] -> ShowS
show :: ImportComponent -> String
$cshow :: ImportComponent -> String
showsPrec :: Int -> ImportComponent -> ShowS
$cshowsPrec :: Int -> ImportComponent -> ShowS
Prelude.Show, forall x. Rep ImportComponent x -> ImportComponent
forall x. ImportComponent -> Rep ImportComponent x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ImportComponent x -> ImportComponent
$cfrom :: forall x. ImportComponent -> Rep ImportComponent x
Prelude.Generic)

-- |
-- Create a value of 'ImportComponent' 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:
--
-- 'changeDescription', 'importComponent_changeDescription' - The change description of the component. Describes what change has been
-- made in this version, or what makes this version different from other
-- versions of this component.
--
-- 'data'', 'importComponent_data' - The data of the component. Used to specify the data inline. Either
-- @data@ or @uri@ can be used to specify the data within the component.
--
-- 'description', 'importComponent_description' - The description of the component. Describes the contents of the
-- component.
--
-- 'kmsKeyId', 'importComponent_kmsKeyId' - The ID of the KMS key that should be used to encrypt this component.
--
-- 'tags', 'importComponent_tags' - The tags of the component.
--
-- 'uri', 'importComponent_uri' - The uri of the component. Must be an Amazon S3 URL and the requester
-- must have permission to access the Amazon S3 bucket. If you use Amazon
-- S3, you can specify component content up to your service quota. Either
-- @data@ or @uri@ can be used to specify the data within the component.
--
-- 'name', 'importComponent_name' - The name of the component.
--
-- 'semanticVersion', 'importComponent_semanticVersion' - The semantic version of the component. This version follows the semantic
-- version syntax.
--
-- The semantic version has four nodes:
-- \<major>.\<minor>.\<patch>\/\<build>. You can assign values for the
-- first three, and can filter on all of them.
--
-- __Filtering:__ With semantic versioning, you have the flexibility to use
-- wildcards (x) to specify the most recent versions or nodes when
-- selecting the base image or components for your recipe. When you use a
-- wildcard in any node, all nodes to the right of the first wildcard must
-- also be wildcards.
--
-- 'type'', 'importComponent_type' - The type of the component denotes whether the component is used to build
-- the image, or only to test it.
--
-- 'format', 'importComponent_format' - The format of the resource that you want to import as a component.
--
-- 'platform', 'importComponent_platform' - The platform of the component.
--
-- 'clientToken', 'importComponent_clientToken' - The idempotency token of the component.
newImportComponent ::
  -- | 'name'
  Prelude.Text ->
  -- | 'semanticVersion'
  Prelude.Text ->
  -- | 'type''
  ComponentType ->
  -- | 'format'
  ComponentFormat ->
  -- | 'platform'
  Platform ->
  -- | 'clientToken'
  Prelude.Text ->
  ImportComponent
newImportComponent :: Text
-> Text
-> ComponentType
-> ComponentFormat
-> Platform
-> Text
-> ImportComponent
newImportComponent
  Text
pName_
  Text
pSemanticVersion_
  ComponentType
pType_
  ComponentFormat
pFormat_
  Platform
pPlatform_
  Text
pClientToken_ =
    ImportComponent'
      { $sel:changeDescription:ImportComponent' :: Maybe Text
changeDescription =
          forall a. Maybe a
Prelude.Nothing,
        $sel:data':ImportComponent' :: Maybe Text
data' = forall a. Maybe a
Prelude.Nothing,
        $sel:description:ImportComponent' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
        $sel:kmsKeyId:ImportComponent' :: Maybe Text
kmsKeyId = forall a. Maybe a
Prelude.Nothing,
        $sel:tags:ImportComponent' :: Maybe (HashMap Text Text)
tags = forall a. Maybe a
Prelude.Nothing,
        $sel:uri:ImportComponent' :: Maybe Text
uri = forall a. Maybe a
Prelude.Nothing,
        $sel:name:ImportComponent' :: Text
name = Text
pName_,
        $sel:semanticVersion:ImportComponent' :: Text
semanticVersion = Text
pSemanticVersion_,
        $sel:type':ImportComponent' :: ComponentType
type' = ComponentType
pType_,
        $sel:format:ImportComponent' :: ComponentFormat
format = ComponentFormat
pFormat_,
        $sel:platform:ImportComponent' :: Platform
platform = Platform
pPlatform_,
        $sel:clientToken:ImportComponent' :: Text
clientToken = Text
pClientToken_
      }

-- | The change description of the component. Describes what change has been
-- made in this version, or what makes this version different from other
-- versions of this component.
importComponent_changeDescription :: Lens.Lens' ImportComponent (Prelude.Maybe Prelude.Text)
importComponent_changeDescription :: Lens' ImportComponent (Maybe Text)
importComponent_changeDescription = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportComponent' {Maybe Text
changeDescription :: Maybe Text
$sel:changeDescription:ImportComponent' :: ImportComponent -> Maybe Text
changeDescription} -> Maybe Text
changeDescription) (\s :: ImportComponent
s@ImportComponent' {} Maybe Text
a -> ImportComponent
s {$sel:changeDescription:ImportComponent' :: Maybe Text
changeDescription = Maybe Text
a} :: ImportComponent)

-- | The data of the component. Used to specify the data inline. Either
-- @data@ or @uri@ can be used to specify the data within the component.
importComponent_data :: Lens.Lens' ImportComponent (Prelude.Maybe Prelude.Text)
importComponent_data :: Lens' ImportComponent (Maybe Text)
importComponent_data = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportComponent' {Maybe Text
data' :: Maybe Text
$sel:data':ImportComponent' :: ImportComponent -> Maybe Text
data'} -> Maybe Text
data') (\s :: ImportComponent
s@ImportComponent' {} Maybe Text
a -> ImportComponent
s {$sel:data':ImportComponent' :: Maybe Text
data' = Maybe Text
a} :: ImportComponent)

-- | The description of the component. Describes the contents of the
-- component.
importComponent_description :: Lens.Lens' ImportComponent (Prelude.Maybe Prelude.Text)
importComponent_description :: Lens' ImportComponent (Maybe Text)
importComponent_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportComponent' {Maybe Text
description :: Maybe Text
$sel:description:ImportComponent' :: ImportComponent -> Maybe Text
description} -> Maybe Text
description) (\s :: ImportComponent
s@ImportComponent' {} Maybe Text
a -> ImportComponent
s {$sel:description:ImportComponent' :: Maybe Text
description = Maybe Text
a} :: ImportComponent)

-- | The ID of the KMS key that should be used to encrypt this component.
importComponent_kmsKeyId :: Lens.Lens' ImportComponent (Prelude.Maybe Prelude.Text)
importComponent_kmsKeyId :: Lens' ImportComponent (Maybe Text)
importComponent_kmsKeyId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportComponent' {Maybe Text
kmsKeyId :: Maybe Text
$sel:kmsKeyId:ImportComponent' :: ImportComponent -> Maybe Text
kmsKeyId} -> Maybe Text
kmsKeyId) (\s :: ImportComponent
s@ImportComponent' {} Maybe Text
a -> ImportComponent
s {$sel:kmsKeyId:ImportComponent' :: Maybe Text
kmsKeyId = Maybe Text
a} :: ImportComponent)

-- | The tags of the component.
importComponent_tags :: Lens.Lens' ImportComponent (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
importComponent_tags :: Lens' ImportComponent (Maybe (HashMap Text Text))
importComponent_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportComponent' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:ImportComponent' :: ImportComponent -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: ImportComponent
s@ImportComponent' {} Maybe (HashMap Text Text)
a -> ImportComponent
s {$sel:tags:ImportComponent' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: ImportComponent) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The uri of the component. Must be an Amazon S3 URL and the requester
-- must have permission to access the Amazon S3 bucket. If you use Amazon
-- S3, you can specify component content up to your service quota. Either
-- @data@ or @uri@ can be used to specify the data within the component.
importComponent_uri :: Lens.Lens' ImportComponent (Prelude.Maybe Prelude.Text)
importComponent_uri :: Lens' ImportComponent (Maybe Text)
importComponent_uri = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportComponent' {Maybe Text
uri :: Maybe Text
$sel:uri:ImportComponent' :: ImportComponent -> Maybe Text
uri} -> Maybe Text
uri) (\s :: ImportComponent
s@ImportComponent' {} Maybe Text
a -> ImportComponent
s {$sel:uri:ImportComponent' :: Maybe Text
uri = Maybe Text
a} :: ImportComponent)

-- | The name of the component.
importComponent_name :: Lens.Lens' ImportComponent Prelude.Text
importComponent_name :: Lens' ImportComponent Text
importComponent_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportComponent' {Text
name :: Text
$sel:name:ImportComponent' :: ImportComponent -> Text
name} -> Text
name) (\s :: ImportComponent
s@ImportComponent' {} Text
a -> ImportComponent
s {$sel:name:ImportComponent' :: Text
name = Text
a} :: ImportComponent)

-- | The semantic version of the component. This version follows the semantic
-- version syntax.
--
-- The semantic version has four nodes:
-- \<major>.\<minor>.\<patch>\/\<build>. You can assign values for the
-- first three, and can filter on all of them.
--
-- __Filtering:__ With semantic versioning, you have the flexibility to use
-- wildcards (x) to specify the most recent versions or nodes when
-- selecting the base image or components for your recipe. When you use a
-- wildcard in any node, all nodes to the right of the first wildcard must
-- also be wildcards.
importComponent_semanticVersion :: Lens.Lens' ImportComponent Prelude.Text
importComponent_semanticVersion :: Lens' ImportComponent Text
importComponent_semanticVersion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportComponent' {Text
semanticVersion :: Text
$sel:semanticVersion:ImportComponent' :: ImportComponent -> Text
semanticVersion} -> Text
semanticVersion) (\s :: ImportComponent
s@ImportComponent' {} Text
a -> ImportComponent
s {$sel:semanticVersion:ImportComponent' :: Text
semanticVersion = Text
a} :: ImportComponent)

-- | The type of the component denotes whether the component is used to build
-- the image, or only to test it.
importComponent_type :: Lens.Lens' ImportComponent ComponentType
importComponent_type :: Lens' ImportComponent ComponentType
importComponent_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportComponent' {ComponentType
type' :: ComponentType
$sel:type':ImportComponent' :: ImportComponent -> ComponentType
type'} -> ComponentType
type') (\s :: ImportComponent
s@ImportComponent' {} ComponentType
a -> ImportComponent
s {$sel:type':ImportComponent' :: ComponentType
type' = ComponentType
a} :: ImportComponent)

-- | The format of the resource that you want to import as a component.
importComponent_format :: Lens.Lens' ImportComponent ComponentFormat
importComponent_format :: Lens' ImportComponent ComponentFormat
importComponent_format = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportComponent' {ComponentFormat
format :: ComponentFormat
$sel:format:ImportComponent' :: ImportComponent -> ComponentFormat
format} -> ComponentFormat
format) (\s :: ImportComponent
s@ImportComponent' {} ComponentFormat
a -> ImportComponent
s {$sel:format:ImportComponent' :: ComponentFormat
format = ComponentFormat
a} :: ImportComponent)

-- | The platform of the component.
importComponent_platform :: Lens.Lens' ImportComponent Platform
importComponent_platform :: Lens' ImportComponent Platform
importComponent_platform = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportComponent' {Platform
platform :: Platform
$sel:platform:ImportComponent' :: ImportComponent -> Platform
platform} -> Platform
platform) (\s :: ImportComponent
s@ImportComponent' {} Platform
a -> ImportComponent
s {$sel:platform:ImportComponent' :: Platform
platform = Platform
a} :: ImportComponent)

-- | The idempotency token of the component.
importComponent_clientToken :: Lens.Lens' ImportComponent Prelude.Text
importComponent_clientToken :: Lens' ImportComponent Text
importComponent_clientToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportComponent' {Text
clientToken :: Text
$sel:clientToken:ImportComponent' :: ImportComponent -> Text
clientToken} -> Text
clientToken) (\s :: ImportComponent
s@ImportComponent' {} Text
a -> ImportComponent
s {$sel:clientToken:ImportComponent' :: Text
clientToken = Text
a} :: ImportComponent)

instance Core.AWSRequest ImportComponent where
  type
    AWSResponse ImportComponent =
      ImportComponentResponse
  request :: (Service -> Service) -> ImportComponent -> Request ImportComponent
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ImportComponent
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ImportComponent)))
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 Text -> Maybe Text -> Int -> ImportComponentResponse
ImportComponentResponse'
            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
"clientToken")
            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
"componentBuildVersionArn")
            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
"requestId")
            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 ImportComponent where
  hashWithSalt :: Int -> ImportComponent -> Int
hashWithSalt Int
_salt ImportComponent' {Maybe Text
Maybe (HashMap Text Text)
Text
ComponentFormat
ComponentType
Platform
clientToken :: Text
platform :: Platform
format :: ComponentFormat
type' :: ComponentType
semanticVersion :: Text
name :: Text
uri :: Maybe Text
tags :: Maybe (HashMap Text Text)
kmsKeyId :: Maybe Text
description :: Maybe Text
data' :: Maybe Text
changeDescription :: Maybe Text
$sel:clientToken:ImportComponent' :: ImportComponent -> Text
$sel:platform:ImportComponent' :: ImportComponent -> Platform
$sel:format:ImportComponent' :: ImportComponent -> ComponentFormat
$sel:type':ImportComponent' :: ImportComponent -> ComponentType
$sel:semanticVersion:ImportComponent' :: ImportComponent -> Text
$sel:name:ImportComponent' :: ImportComponent -> Text
$sel:uri:ImportComponent' :: ImportComponent -> Maybe Text
$sel:tags:ImportComponent' :: ImportComponent -> Maybe (HashMap Text Text)
$sel:kmsKeyId:ImportComponent' :: ImportComponent -> Maybe Text
$sel:description:ImportComponent' :: ImportComponent -> Maybe Text
$sel:data':ImportComponent' :: ImportComponent -> Maybe Text
$sel:changeDescription:ImportComponent' :: ImportComponent -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
changeDescription
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
data'
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
kmsKeyId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
tags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
uri
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
semanticVersion
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ComponentType
type'
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ComponentFormat
format
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Platform
platform
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
clientToken

instance Prelude.NFData ImportComponent where
  rnf :: ImportComponent -> ()
rnf ImportComponent' {Maybe Text
Maybe (HashMap Text Text)
Text
ComponentFormat
ComponentType
Platform
clientToken :: Text
platform :: Platform
format :: ComponentFormat
type' :: ComponentType
semanticVersion :: Text
name :: Text
uri :: Maybe Text
tags :: Maybe (HashMap Text Text)
kmsKeyId :: Maybe Text
description :: Maybe Text
data' :: Maybe Text
changeDescription :: Maybe Text
$sel:clientToken:ImportComponent' :: ImportComponent -> Text
$sel:platform:ImportComponent' :: ImportComponent -> Platform
$sel:format:ImportComponent' :: ImportComponent -> ComponentFormat
$sel:type':ImportComponent' :: ImportComponent -> ComponentType
$sel:semanticVersion:ImportComponent' :: ImportComponent -> Text
$sel:name:ImportComponent' :: ImportComponent -> Text
$sel:uri:ImportComponent' :: ImportComponent -> Maybe Text
$sel:tags:ImportComponent' :: ImportComponent -> Maybe (HashMap Text Text)
$sel:kmsKeyId:ImportComponent' :: ImportComponent -> Maybe Text
$sel:description:ImportComponent' :: ImportComponent -> Maybe Text
$sel:data':ImportComponent' :: ImportComponent -> Maybe Text
$sel:changeDescription:ImportComponent' :: ImportComponent -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
changeDescription
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
data'
      seq :: forall a b. a -> b -> b
`Prelude.seq` 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 Text
kmsKeyId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
tags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
uri
      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
semanticVersion
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ComponentType
type'
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ComponentFormat
format
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Platform
platform
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
clientToken

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

instance Data.ToJSON ImportComponent where
  toJSON :: ImportComponent -> Value
toJSON ImportComponent' {Maybe Text
Maybe (HashMap Text Text)
Text
ComponentFormat
ComponentType
Platform
clientToken :: Text
platform :: Platform
format :: ComponentFormat
type' :: ComponentType
semanticVersion :: Text
name :: Text
uri :: Maybe Text
tags :: Maybe (HashMap Text Text)
kmsKeyId :: Maybe Text
description :: Maybe Text
data' :: Maybe Text
changeDescription :: Maybe Text
$sel:clientToken:ImportComponent' :: ImportComponent -> Text
$sel:platform:ImportComponent' :: ImportComponent -> Platform
$sel:format:ImportComponent' :: ImportComponent -> ComponentFormat
$sel:type':ImportComponent' :: ImportComponent -> ComponentType
$sel:semanticVersion:ImportComponent' :: ImportComponent -> Text
$sel:name:ImportComponent' :: ImportComponent -> Text
$sel:uri:ImportComponent' :: ImportComponent -> Maybe Text
$sel:tags:ImportComponent' :: ImportComponent -> Maybe (HashMap Text Text)
$sel:kmsKeyId:ImportComponent' :: ImportComponent -> Maybe Text
$sel:description:ImportComponent' :: ImportComponent -> Maybe Text
$sel:data':ImportComponent' :: ImportComponent -> Maybe Text
$sel:changeDescription:ImportComponent' :: ImportComponent -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"changeDescription" 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
changeDescription,
            (Key
"data" 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
data',
            (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
"kmsKeyId" 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
kmsKeyId,
            (Key
"tags" 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 (HashMap Text Text)
tags,
            (Key
"uri" 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
uri,
            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
"semanticVersion" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
semanticVersion),
            forall a. a -> Maybe a
Prelude.Just (Key
"type" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= ComponentType
type'),
            forall a. a -> Maybe a
Prelude.Just (Key
"format" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= ComponentFormat
format),
            forall a. a -> Maybe a
Prelude.Just (Key
"platform" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Platform
platform),
            forall a. a -> Maybe a
Prelude.Just (Key
"clientToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
clientToken)
          ]
      )

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

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

-- | /See:/ 'newImportComponentResponse' smart constructor.
data ImportComponentResponse = ImportComponentResponse'
  { -- | The idempotency token used to make this request idempotent.
    ImportComponentResponse -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the imported component.
    ImportComponentResponse -> Maybe Text
componentBuildVersionArn :: Prelude.Maybe Prelude.Text,
    -- | The request ID that uniquely identifies this request.
    ImportComponentResponse -> Maybe Text
requestId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ImportComponentResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ImportComponentResponse -> ImportComponentResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ImportComponentResponse -> ImportComponentResponse -> Bool
$c/= :: ImportComponentResponse -> ImportComponentResponse -> Bool
== :: ImportComponentResponse -> ImportComponentResponse -> Bool
$c== :: ImportComponentResponse -> ImportComponentResponse -> Bool
Prelude.Eq, ReadPrec [ImportComponentResponse]
ReadPrec ImportComponentResponse
Int -> ReadS ImportComponentResponse
ReadS [ImportComponentResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ImportComponentResponse]
$creadListPrec :: ReadPrec [ImportComponentResponse]
readPrec :: ReadPrec ImportComponentResponse
$creadPrec :: ReadPrec ImportComponentResponse
readList :: ReadS [ImportComponentResponse]
$creadList :: ReadS [ImportComponentResponse]
readsPrec :: Int -> ReadS ImportComponentResponse
$creadsPrec :: Int -> ReadS ImportComponentResponse
Prelude.Read, Int -> ImportComponentResponse -> ShowS
[ImportComponentResponse] -> ShowS
ImportComponentResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ImportComponentResponse] -> ShowS
$cshowList :: [ImportComponentResponse] -> ShowS
show :: ImportComponentResponse -> String
$cshow :: ImportComponentResponse -> String
showsPrec :: Int -> ImportComponentResponse -> ShowS
$cshowsPrec :: Int -> ImportComponentResponse -> ShowS
Prelude.Show, forall x. Rep ImportComponentResponse x -> ImportComponentResponse
forall x. ImportComponentResponse -> Rep ImportComponentResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ImportComponentResponse x -> ImportComponentResponse
$cfrom :: forall x. ImportComponentResponse -> Rep ImportComponentResponse x
Prelude.Generic)

-- |
-- Create a value of 'ImportComponentResponse' 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:
--
-- 'clientToken', 'importComponentResponse_clientToken' - The idempotency token used to make this request idempotent.
--
-- 'componentBuildVersionArn', 'importComponentResponse_componentBuildVersionArn' - The Amazon Resource Name (ARN) of the imported component.
--
-- 'requestId', 'importComponentResponse_requestId' - The request ID that uniquely identifies this request.
--
-- 'httpStatus', 'importComponentResponse_httpStatus' - The response's http status code.
newImportComponentResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ImportComponentResponse
newImportComponentResponse :: Int -> ImportComponentResponse
newImportComponentResponse Int
pHttpStatus_ =
  ImportComponentResponse'
    { $sel:clientToken:ImportComponentResponse' :: Maybe Text
clientToken =
        forall a. Maybe a
Prelude.Nothing,
      $sel:componentBuildVersionArn:ImportComponentResponse' :: Maybe Text
componentBuildVersionArn = forall a. Maybe a
Prelude.Nothing,
      $sel:requestId:ImportComponentResponse' :: Maybe Text
requestId = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ImportComponentResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The idempotency token used to make this request idempotent.
importComponentResponse_clientToken :: Lens.Lens' ImportComponentResponse (Prelude.Maybe Prelude.Text)
importComponentResponse_clientToken :: Lens' ImportComponentResponse (Maybe Text)
importComponentResponse_clientToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportComponentResponse' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:ImportComponentResponse' :: ImportComponentResponse -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: ImportComponentResponse
s@ImportComponentResponse' {} Maybe Text
a -> ImportComponentResponse
s {$sel:clientToken:ImportComponentResponse' :: Maybe Text
clientToken = Maybe Text
a} :: ImportComponentResponse)

-- | The Amazon Resource Name (ARN) of the imported component.
importComponentResponse_componentBuildVersionArn :: Lens.Lens' ImportComponentResponse (Prelude.Maybe Prelude.Text)
importComponentResponse_componentBuildVersionArn :: Lens' ImportComponentResponse (Maybe Text)
importComponentResponse_componentBuildVersionArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportComponentResponse' {Maybe Text
componentBuildVersionArn :: Maybe Text
$sel:componentBuildVersionArn:ImportComponentResponse' :: ImportComponentResponse -> Maybe Text
componentBuildVersionArn} -> Maybe Text
componentBuildVersionArn) (\s :: ImportComponentResponse
s@ImportComponentResponse' {} Maybe Text
a -> ImportComponentResponse
s {$sel:componentBuildVersionArn:ImportComponentResponse' :: Maybe Text
componentBuildVersionArn = Maybe Text
a} :: ImportComponentResponse)

-- | The request ID that uniquely identifies this request.
importComponentResponse_requestId :: Lens.Lens' ImportComponentResponse (Prelude.Maybe Prelude.Text)
importComponentResponse_requestId :: Lens' ImportComponentResponse (Maybe Text)
importComponentResponse_requestId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportComponentResponse' {Maybe Text
requestId :: Maybe Text
$sel:requestId:ImportComponentResponse' :: ImportComponentResponse -> Maybe Text
requestId} -> Maybe Text
requestId) (\s :: ImportComponentResponse
s@ImportComponentResponse' {} Maybe Text
a -> ImportComponentResponse
s {$sel:requestId:ImportComponentResponse' :: Maybe Text
requestId = Maybe Text
a} :: ImportComponentResponse)

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

instance Prelude.NFData ImportComponentResponse where
  rnf :: ImportComponentResponse -> ()
rnf ImportComponentResponse' {Int
Maybe Text
httpStatus :: Int
requestId :: Maybe Text
componentBuildVersionArn :: Maybe Text
clientToken :: Maybe Text
$sel:httpStatus:ImportComponentResponse' :: ImportComponentResponse -> Int
$sel:requestId:ImportComponentResponse' :: ImportComponentResponse -> Maybe Text
$sel:componentBuildVersionArn:ImportComponentResponse' :: ImportComponentResponse -> Maybe Text
$sel:clientToken:ImportComponentResponse' :: ImportComponentResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
clientToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
componentBuildVersionArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
requestId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus