{-# 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-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)
--
-- Imports a component and transforms its data into a component document.
module Amazonka.ImageBuilder.ImportComponent
  ( -- * Creating a Request
    ImportComponent (..),
    newImportComponent,

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

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

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

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

-- | /See:/ 'newImportComponent' smart constructor.
data ImportComponent = 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 -> Maybe Text
data' :: Prelude.Maybe 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 ID of the KMS key that should be used to encrypt this component.
    ImportComponent -> Maybe Text
kmsKeyId :: Prelude.Maybe Prelude.Text,
    -- | 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 description of the component. Describes the contents of the
    -- component.
    ImportComponent -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The tags of the component.
    ImportComponent -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text 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
(ImportComponent -> ImportComponent -> Bool)
-> (ImportComponent -> ImportComponent -> Bool)
-> Eq ImportComponent
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]
(Int -> ReadS ImportComponent)
-> ReadS [ImportComponent]
-> ReadPrec ImportComponent
-> ReadPrec [ImportComponent]
-> Read 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
(Int -> ImportComponent -> ShowS)
-> (ImportComponent -> String)
-> ([ImportComponent] -> ShowS)
-> Show ImportComponent
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. ImportComponent -> Rep ImportComponent x)
-> (forall x. Rep ImportComponent x -> ImportComponent)
-> Generic ImportComponent
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:
--
-- '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.
--
-- '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.
--
-- 'kmsKeyId', 'importComponent_kmsKeyId' - The ID of the KMS key that should be used to encrypt this component.
--
-- '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.
--
-- 'description', 'importComponent_description' - The description of the component. Describes the contents of the
-- component.
--
-- 'tags', 'importComponent_tags' - The tags of 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' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Text
-> Text
-> ComponentType
-> ComponentFormat
-> Platform
-> Text
-> ImportComponent
ImportComponent'
      { $sel:data':ImportComponent' :: Maybe Text
data' = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:uri:ImportComponent' :: Maybe Text
uri = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:kmsKeyId:ImportComponent' :: Maybe Text
kmsKeyId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:changeDescription:ImportComponent' :: Maybe Text
changeDescription = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:description:ImportComponent' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:ImportComponent' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
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 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 :: (Maybe Text -> f (Maybe Text))
-> ImportComponent -> f ImportComponent
importComponent_data = (ImportComponent -> Maybe Text)
-> (ImportComponent -> Maybe Text -> ImportComponent)
-> Lens ImportComponent ImportComponent (Maybe Text) (Maybe Text)
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 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 :: (Maybe Text -> f (Maybe Text))
-> ImportComponent -> f ImportComponent
importComponent_uri = (ImportComponent -> Maybe Text)
-> (ImportComponent -> Maybe Text -> ImportComponent)
-> Lens ImportComponent ImportComponent (Maybe Text) (Maybe Text)
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 ID of the KMS key that should be used to encrypt this component.
importComponent_kmsKeyId :: Lens.Lens' ImportComponent (Prelude.Maybe Prelude.Text)
importComponent_kmsKeyId :: (Maybe Text -> f (Maybe Text))
-> ImportComponent -> f ImportComponent
importComponent_kmsKeyId = (ImportComponent -> Maybe Text)
-> (ImportComponent -> Maybe Text -> ImportComponent)
-> Lens ImportComponent ImportComponent (Maybe Text) (Maybe Text)
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 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 :: (Maybe Text -> f (Maybe Text))
-> ImportComponent -> f ImportComponent
importComponent_changeDescription = (ImportComponent -> Maybe Text)
-> (ImportComponent -> Maybe Text -> ImportComponent)
-> Lens ImportComponent ImportComponent (Maybe Text) (Maybe Text)
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 description of the component. Describes the contents of the
-- component.
importComponent_description :: Lens.Lens' ImportComponent (Prelude.Maybe Prelude.Text)
importComponent_description :: (Maybe Text -> f (Maybe Text))
-> ImportComponent -> f ImportComponent
importComponent_description = (ImportComponent -> Maybe Text)
-> (ImportComponent -> Maybe Text -> ImportComponent)
-> Lens ImportComponent ImportComponent (Maybe Text) (Maybe Text)
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 tags of the component.
importComponent_tags :: Lens.Lens' ImportComponent (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
importComponent_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> ImportComponent -> f ImportComponent
importComponent_tags = (ImportComponent -> Maybe (HashMap Text Text))
-> (ImportComponent
    -> Maybe (HashMap Text Text) -> ImportComponent)
-> Lens
     ImportComponent
     ImportComponent
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\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) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> ImportComponent -> f ImportComponent)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> ImportComponent
-> f ImportComponent
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name of the component.
importComponent_name :: Lens.Lens' ImportComponent Prelude.Text
importComponent_name :: (Text -> f Text) -> ImportComponent -> f ImportComponent
importComponent_name = (ImportComponent -> Text)
-> (ImportComponent -> Text -> ImportComponent)
-> Lens ImportComponent ImportComponent Text Text
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 :: (Text -> f Text) -> ImportComponent -> f ImportComponent
importComponent_semanticVersion = (ImportComponent -> Text)
-> (ImportComponent -> Text -> ImportComponent)
-> Lens ImportComponent ImportComponent Text Text
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 :: (ComponentType -> f ComponentType)
-> ImportComponent -> f ImportComponent
importComponent_type = (ImportComponent -> ComponentType)
-> (ImportComponent -> ComponentType -> ImportComponent)
-> Lens ImportComponent ImportComponent ComponentType ComponentType
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 :: (ComponentFormat -> f ComponentFormat)
-> ImportComponent -> f ImportComponent
importComponent_format = (ImportComponent -> ComponentFormat)
-> (ImportComponent -> ComponentFormat -> ImportComponent)
-> Lens
     ImportComponent ImportComponent ComponentFormat ComponentFormat
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 :: (Platform -> f Platform) -> ImportComponent -> f ImportComponent
importComponent_platform = (ImportComponent -> Platform)
-> (ImportComponent -> Platform -> ImportComponent)
-> Lens ImportComponent ImportComponent Platform 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 :: (Text -> f Text) -> ImportComponent -> f ImportComponent
importComponent_clientToken = (ImportComponent -> Text)
-> (ImportComponent -> Text -> ImportComponent)
-> Lens ImportComponent ImportComponent Text Text
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 :: ImportComponent -> Request ImportComponent
request = Service -> ImportComponent -> Request ImportComponent
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ImportComponent
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ImportComponent)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ImportComponent))
-> Logger
-> Service
-> Proxy ImportComponent
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ImportComponent)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text
-> Maybe Text -> Maybe Text -> Int -> ImportComponentResponse
ImportComponentResponse'
            (Maybe Text
 -> Maybe Text -> Maybe Text -> Int -> ImportComponentResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe Text -> Maybe Text -> Int -> ImportComponentResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"requestId")
            Either
  String (Maybe Text -> Maybe Text -> Int -> ImportComponentResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> ImportComponentResponse)
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
"clientToken")
            Either String (Maybe Text -> Int -> ImportComponentResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ImportComponentResponse)
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
"componentBuildVersionArn")
            Either String (Int -> ImportComponentResponse)
-> Either String Int -> Either String ImportComponentResponse
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 ImportComponent

instance Prelude.NFData ImportComponent

instance Core.ToHeaders ImportComponent where
  toHeaders :: ImportComponent -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ImportComponent -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ 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 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
tags :: Maybe (HashMap Text Text)
description :: Maybe Text
changeDescription :: Maybe Text
kmsKeyId :: Maybe Text
uri :: Maybe Text
data' :: 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:tags:ImportComponent' :: ImportComponent -> Maybe (HashMap Text Text)
$sel:description:ImportComponent' :: ImportComponent -> Maybe Text
$sel:changeDescription:ImportComponent' :: ImportComponent -> Maybe Text
$sel:kmsKeyId:ImportComponent' :: ImportComponent -> Maybe Text
$sel:uri:ImportComponent' :: ImportComponent -> Maybe Text
$sel:data':ImportComponent' :: ImportComponent -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"data" 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
data',
            (Text
"uri" 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
uri,
            (Text
"kmsKeyId" 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
kmsKeyId,
            (Text
"changeDescription" 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
changeDescription,
            (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,
            (Text
"tags" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
tags,
            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
"semanticVersion" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
semanticVersion),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"type" Text -> ComponentType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ComponentType
type'),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"format" Text -> ComponentFormat -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ComponentFormat
format),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"platform" Text -> Platform -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Platform
platform),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"clientToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
clientToken)
          ]
      )

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

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

-- | /See:/ 'newImportComponentResponse' smart constructor.
data ImportComponentResponse = ImportComponentResponse'
  { -- | The request ID that uniquely identifies this request.
    ImportComponentResponse -> Maybe Text
requestId :: Prelude.Maybe Prelude.Text,
    -- | 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 response's http status code.
    ImportComponentResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ImportComponentResponse -> ImportComponentResponse -> Bool
(ImportComponentResponse -> ImportComponentResponse -> Bool)
-> (ImportComponentResponse -> ImportComponentResponse -> Bool)
-> Eq ImportComponentResponse
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]
(Int -> ReadS ImportComponentResponse)
-> ReadS [ImportComponentResponse]
-> ReadPrec ImportComponentResponse
-> ReadPrec [ImportComponentResponse]
-> Read 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
(Int -> ImportComponentResponse -> ShowS)
-> (ImportComponentResponse -> String)
-> ([ImportComponentResponse] -> ShowS)
-> Show ImportComponentResponse
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.
 ImportComponentResponse -> Rep ImportComponentResponse x)
-> (forall x.
    Rep ImportComponentResponse x -> ImportComponentResponse)
-> Generic ImportComponentResponse
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:
--
-- 'requestId', 'importComponentResponse_requestId' - The request ID that uniquely identifies this request.
--
-- 'clientToken', 'importComponentResponse_clientToken' - The idempotency token used to make this request idempotent.
--
-- 'componentBuildVersionArn', 'importComponentResponse_componentBuildVersionArn' - The Amazon Resource Name (ARN) of the imported component.
--
-- 'httpStatus', 'importComponentResponse_httpStatus' - The response's http status code.
newImportComponentResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ImportComponentResponse
newImportComponentResponse :: Int -> ImportComponentResponse
newImportComponentResponse Int
pHttpStatus_ =
  ImportComponentResponse' :: Maybe Text
-> Maybe Text -> Maybe Text -> Int -> ImportComponentResponse
ImportComponentResponse'
    { $sel:requestId:ImportComponentResponse' :: Maybe Text
requestId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:clientToken:ImportComponentResponse' :: Maybe Text
clientToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:componentBuildVersionArn:ImportComponentResponse' :: Maybe Text
componentBuildVersionArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ImportComponentResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The request ID that uniquely identifies this request.
importComponentResponse_requestId :: Lens.Lens' ImportComponentResponse (Prelude.Maybe Prelude.Text)
importComponentResponse_requestId :: (Maybe Text -> f (Maybe Text))
-> ImportComponentResponse -> f ImportComponentResponse
importComponentResponse_requestId = (ImportComponentResponse -> Maybe Text)
-> (ImportComponentResponse
    -> Maybe Text -> ImportComponentResponse)
-> Lens
     ImportComponentResponse
     ImportComponentResponse
     (Maybe Text)
     (Maybe Text)
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 idempotency token used to make this request idempotent.
importComponentResponse_clientToken :: Lens.Lens' ImportComponentResponse (Prelude.Maybe Prelude.Text)
importComponentResponse_clientToken :: (Maybe Text -> f (Maybe Text))
-> ImportComponentResponse -> f ImportComponentResponse
importComponentResponse_clientToken = (ImportComponentResponse -> Maybe Text)
-> (ImportComponentResponse
    -> Maybe Text -> ImportComponentResponse)
-> Lens
     ImportComponentResponse
     ImportComponentResponse
     (Maybe Text)
     (Maybe Text)
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 :: (Maybe Text -> f (Maybe Text))
-> ImportComponentResponse -> f ImportComponentResponse
importComponentResponse_componentBuildVersionArn = (ImportComponentResponse -> Maybe Text)
-> (ImportComponentResponse
    -> Maybe Text -> ImportComponentResponse)
-> Lens
     ImportComponentResponse
     ImportComponentResponse
     (Maybe Text)
     (Maybe Text)
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 response's http status code.
importComponentResponse_httpStatus :: Lens.Lens' ImportComponentResponse Prelude.Int
importComponentResponse_httpStatus :: (Int -> f Int)
-> ImportComponentResponse -> f ImportComponentResponse
importComponentResponse_httpStatus = (ImportComponentResponse -> Int)
-> (ImportComponentResponse -> Int -> ImportComponentResponse)
-> Lens ImportComponentResponse ImportComponentResponse Int Int
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