{-# 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.ECS.RegisterContainerInstance
-- 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)
--
-- This action is only used by the Amazon ECS agent, and it is not intended
-- for use outside of the agent.
--
-- Registers an EC2 instance into the specified cluster. This instance
-- becomes available to place containers on.
module Amazonka.ECS.RegisterContainerInstance
  ( -- * Creating a Request
    RegisterContainerInstance (..),
    newRegisterContainerInstance,

    -- * Request Lenses
    registerContainerInstance_platformDevices,
    registerContainerInstance_instanceIdentityDocumentSignature,
    registerContainerInstance_cluster,
    registerContainerInstance_instanceIdentityDocument,
    registerContainerInstance_containerInstanceArn,
    registerContainerInstance_versionInfo,
    registerContainerInstance_attributes,
    registerContainerInstance_totalResources,
    registerContainerInstance_tags,

    -- * Destructuring the Response
    RegisterContainerInstanceResponse (..),
    newRegisterContainerInstanceResponse,

    -- * Response Lenses
    registerContainerInstanceResponse_containerInstance,
    registerContainerInstanceResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.ECS.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:/ 'newRegisterContainerInstance' smart constructor.
data RegisterContainerInstance = RegisterContainerInstance'
  { -- | The devices that are available on the container instance. The only
    -- supported device type is a GPU.
    RegisterContainerInstance -> Maybe [PlatformDevice]
platformDevices :: Prelude.Maybe [PlatformDevice],
    -- | The instance identity document signature for the EC2 instance to
    -- register. This signature can be found by running the following command
    -- from the instance:
    -- @curl http:\/\/169.254.169.254\/latest\/dynamic\/instance-identity\/signature\/@
    RegisterContainerInstance -> Maybe Text
instanceIdentityDocumentSignature :: Prelude.Maybe Prelude.Text,
    -- | The short name or full Amazon Resource Name (ARN) of the cluster with
    -- which to register your container instance. If you do not specify a
    -- cluster, the default cluster is assumed.
    RegisterContainerInstance -> Maybe Text
cluster :: Prelude.Maybe Prelude.Text,
    -- | The instance identity document for the EC2 instance to register. This
    -- document can be found by running the following command from the
    -- instance:
    -- @curl http:\/\/169.254.169.254\/latest\/dynamic\/instance-identity\/document\/@
    RegisterContainerInstance -> Maybe Text
instanceIdentityDocument :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the container instance (if it was previously registered).
    RegisterContainerInstance -> Maybe Text
containerInstanceArn :: Prelude.Maybe Prelude.Text,
    -- | The version information for the Amazon ECS container agent and Docker
    -- daemon running on the container instance.
    RegisterContainerInstance -> Maybe VersionInfo
versionInfo :: Prelude.Maybe VersionInfo,
    -- | The container instance attributes that this container instance supports.
    RegisterContainerInstance -> Maybe [Attribute]
attributes :: Prelude.Maybe [Attribute],
    -- | The resources available on the instance.
    RegisterContainerInstance -> Maybe [Resource]
totalResources :: Prelude.Maybe [Resource],
    -- | The metadata that you apply to the container instance to help you
    -- categorize and organize them. Each tag consists of a key and an optional
    -- value, both of which you define.
    --
    -- The following basic restrictions apply to tags:
    --
    -- -   Maximum number of tags per resource - 50
    --
    -- -   For each resource, each tag key must be unique, and each tag key can
    --     have only one value.
    --
    -- -   Maximum key length - 128 Unicode characters in UTF-8
    --
    -- -   Maximum value length - 256 Unicode characters in UTF-8
    --
    -- -   If your tagging schema is used across multiple services and
    --     resources, remember that other services may have restrictions on
    --     allowed characters. Generally allowed characters are: letters,
    --     numbers, and spaces representable in UTF-8, and the following
    --     characters: + - = . _ : \/ \@.
    --
    -- -   Tag keys and values are case-sensitive.
    --
    -- -   Do not use @aws:@, @AWS:@, or any upper or lowercase combination of
    --     such as a prefix for either keys or values as it is reserved for
    --     Amazon Web Services use. You cannot edit or delete tag keys or
    --     values with this prefix. Tags with this prefix do not count against
    --     your tags per resource limit.
    RegisterContainerInstance -> Maybe [Tag]
tags :: Prelude.Maybe [Tag]
  }
  deriving (RegisterContainerInstance -> RegisterContainerInstance -> Bool
(RegisterContainerInstance -> RegisterContainerInstance -> Bool)
-> (RegisterContainerInstance -> RegisterContainerInstance -> Bool)
-> Eq RegisterContainerInstance
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RegisterContainerInstance -> RegisterContainerInstance -> Bool
$c/= :: RegisterContainerInstance -> RegisterContainerInstance -> Bool
== :: RegisterContainerInstance -> RegisterContainerInstance -> Bool
$c== :: RegisterContainerInstance -> RegisterContainerInstance -> Bool
Prelude.Eq, ReadPrec [RegisterContainerInstance]
ReadPrec RegisterContainerInstance
Int -> ReadS RegisterContainerInstance
ReadS [RegisterContainerInstance]
(Int -> ReadS RegisterContainerInstance)
-> ReadS [RegisterContainerInstance]
-> ReadPrec RegisterContainerInstance
-> ReadPrec [RegisterContainerInstance]
-> Read RegisterContainerInstance
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RegisterContainerInstance]
$creadListPrec :: ReadPrec [RegisterContainerInstance]
readPrec :: ReadPrec RegisterContainerInstance
$creadPrec :: ReadPrec RegisterContainerInstance
readList :: ReadS [RegisterContainerInstance]
$creadList :: ReadS [RegisterContainerInstance]
readsPrec :: Int -> ReadS RegisterContainerInstance
$creadsPrec :: Int -> ReadS RegisterContainerInstance
Prelude.Read, Int -> RegisterContainerInstance -> ShowS
[RegisterContainerInstance] -> ShowS
RegisterContainerInstance -> String
(Int -> RegisterContainerInstance -> ShowS)
-> (RegisterContainerInstance -> String)
-> ([RegisterContainerInstance] -> ShowS)
-> Show RegisterContainerInstance
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RegisterContainerInstance] -> ShowS
$cshowList :: [RegisterContainerInstance] -> ShowS
show :: RegisterContainerInstance -> String
$cshow :: RegisterContainerInstance -> String
showsPrec :: Int -> RegisterContainerInstance -> ShowS
$cshowsPrec :: Int -> RegisterContainerInstance -> ShowS
Prelude.Show, (forall x.
 RegisterContainerInstance -> Rep RegisterContainerInstance x)
-> (forall x.
    Rep RegisterContainerInstance x -> RegisterContainerInstance)
-> Generic RegisterContainerInstance
forall x.
Rep RegisterContainerInstance x -> RegisterContainerInstance
forall x.
RegisterContainerInstance -> Rep RegisterContainerInstance x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RegisterContainerInstance x -> RegisterContainerInstance
$cfrom :: forall x.
RegisterContainerInstance -> Rep RegisterContainerInstance x
Prelude.Generic)

-- |
-- Create a value of 'RegisterContainerInstance' 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:
--
-- 'platformDevices', 'registerContainerInstance_platformDevices' - The devices that are available on the container instance. The only
-- supported device type is a GPU.
--
-- 'instanceIdentityDocumentSignature', 'registerContainerInstance_instanceIdentityDocumentSignature' - The instance identity document signature for the EC2 instance to
-- register. This signature can be found by running the following command
-- from the instance:
-- @curl http:\/\/169.254.169.254\/latest\/dynamic\/instance-identity\/signature\/@
--
-- 'cluster', 'registerContainerInstance_cluster' - The short name or full Amazon Resource Name (ARN) of the cluster with
-- which to register your container instance. If you do not specify a
-- cluster, the default cluster is assumed.
--
-- 'instanceIdentityDocument', 'registerContainerInstance_instanceIdentityDocument' - The instance identity document for the EC2 instance to register. This
-- document can be found by running the following command from the
-- instance:
-- @curl http:\/\/169.254.169.254\/latest\/dynamic\/instance-identity\/document\/@
--
-- 'containerInstanceArn', 'registerContainerInstance_containerInstanceArn' - The ARN of the container instance (if it was previously registered).
--
-- 'versionInfo', 'registerContainerInstance_versionInfo' - The version information for the Amazon ECS container agent and Docker
-- daemon running on the container instance.
--
-- 'attributes', 'registerContainerInstance_attributes' - The container instance attributes that this container instance supports.
--
-- 'totalResources', 'registerContainerInstance_totalResources' - The resources available on the instance.
--
-- 'tags', 'registerContainerInstance_tags' - The metadata that you apply to the container instance to help you
-- categorize and organize them. Each tag consists of a key and an optional
-- value, both of which you define.
--
-- The following basic restrictions apply to tags:
--
-- -   Maximum number of tags per resource - 50
--
-- -   For each resource, each tag key must be unique, and each tag key can
--     have only one value.
--
-- -   Maximum key length - 128 Unicode characters in UTF-8
--
-- -   Maximum value length - 256 Unicode characters in UTF-8
--
-- -   If your tagging schema is used across multiple services and
--     resources, remember that other services may have restrictions on
--     allowed characters. Generally allowed characters are: letters,
--     numbers, and spaces representable in UTF-8, and the following
--     characters: + - = . _ : \/ \@.
--
-- -   Tag keys and values are case-sensitive.
--
-- -   Do not use @aws:@, @AWS:@, or any upper or lowercase combination of
--     such as a prefix for either keys or values as it is reserved for
--     Amazon Web Services use. You cannot edit or delete tag keys or
--     values with this prefix. Tags with this prefix do not count against
--     your tags per resource limit.
newRegisterContainerInstance ::
  RegisterContainerInstance
newRegisterContainerInstance :: RegisterContainerInstance
newRegisterContainerInstance =
  RegisterContainerInstance' :: Maybe [PlatformDevice]
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe VersionInfo
-> Maybe [Attribute]
-> Maybe [Resource]
-> Maybe [Tag]
-> RegisterContainerInstance
RegisterContainerInstance'
    { $sel:platformDevices:RegisterContainerInstance' :: Maybe [PlatformDevice]
platformDevices =
        Maybe [PlatformDevice]
forall a. Maybe a
Prelude.Nothing,
      $sel:instanceIdentityDocumentSignature:RegisterContainerInstance' :: Maybe Text
instanceIdentityDocumentSignature =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:cluster:RegisterContainerInstance' :: Maybe Text
cluster = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:instanceIdentityDocument:RegisterContainerInstance' :: Maybe Text
instanceIdentityDocument = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:containerInstanceArn:RegisterContainerInstance' :: Maybe Text
containerInstanceArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:versionInfo:RegisterContainerInstance' :: Maybe VersionInfo
versionInfo = Maybe VersionInfo
forall a. Maybe a
Prelude.Nothing,
      $sel:attributes:RegisterContainerInstance' :: Maybe [Attribute]
attributes = Maybe [Attribute]
forall a. Maybe a
Prelude.Nothing,
      $sel:totalResources:RegisterContainerInstance' :: Maybe [Resource]
totalResources = Maybe [Resource]
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:RegisterContainerInstance' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing
    }

-- | The devices that are available on the container instance. The only
-- supported device type is a GPU.
registerContainerInstance_platformDevices :: Lens.Lens' RegisterContainerInstance (Prelude.Maybe [PlatformDevice])
registerContainerInstance_platformDevices :: (Maybe [PlatformDevice] -> f (Maybe [PlatformDevice]))
-> RegisterContainerInstance -> f RegisterContainerInstance
registerContainerInstance_platformDevices = (RegisterContainerInstance -> Maybe [PlatformDevice])
-> (RegisterContainerInstance
    -> Maybe [PlatformDevice] -> RegisterContainerInstance)
-> Lens
     RegisterContainerInstance
     RegisterContainerInstance
     (Maybe [PlatformDevice])
     (Maybe [PlatformDevice])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterContainerInstance' {Maybe [PlatformDevice]
platformDevices :: Maybe [PlatformDevice]
$sel:platformDevices:RegisterContainerInstance' :: RegisterContainerInstance -> Maybe [PlatformDevice]
platformDevices} -> Maybe [PlatformDevice]
platformDevices) (\s :: RegisterContainerInstance
s@RegisterContainerInstance' {} Maybe [PlatformDevice]
a -> RegisterContainerInstance
s {$sel:platformDevices:RegisterContainerInstance' :: Maybe [PlatformDevice]
platformDevices = Maybe [PlatformDevice]
a} :: RegisterContainerInstance) ((Maybe [PlatformDevice] -> f (Maybe [PlatformDevice]))
 -> RegisterContainerInstance -> f RegisterContainerInstance)
-> ((Maybe [PlatformDevice] -> f (Maybe [PlatformDevice]))
    -> Maybe [PlatformDevice] -> f (Maybe [PlatformDevice]))
-> (Maybe [PlatformDevice] -> f (Maybe [PlatformDevice]))
-> RegisterContainerInstance
-> f RegisterContainerInstance
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [PlatformDevice] [PlatformDevice] [PlatformDevice] [PlatformDevice]
-> Iso
     (Maybe [PlatformDevice])
     (Maybe [PlatformDevice])
     (Maybe [PlatformDevice])
     (Maybe [PlatformDevice])
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
  [PlatformDevice] [PlatformDevice] [PlatformDevice] [PlatformDevice]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The instance identity document signature for the EC2 instance to
-- register. This signature can be found by running the following command
-- from the instance:
-- @curl http:\/\/169.254.169.254\/latest\/dynamic\/instance-identity\/signature\/@
registerContainerInstance_instanceIdentityDocumentSignature :: Lens.Lens' RegisterContainerInstance (Prelude.Maybe Prelude.Text)
registerContainerInstance_instanceIdentityDocumentSignature :: (Maybe Text -> f (Maybe Text))
-> RegisterContainerInstance -> f RegisterContainerInstance
registerContainerInstance_instanceIdentityDocumentSignature = (RegisterContainerInstance -> Maybe Text)
-> (RegisterContainerInstance
    -> Maybe Text -> RegisterContainerInstance)
-> Lens
     RegisterContainerInstance
     RegisterContainerInstance
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterContainerInstance' {Maybe Text
instanceIdentityDocumentSignature :: Maybe Text
$sel:instanceIdentityDocumentSignature:RegisterContainerInstance' :: RegisterContainerInstance -> Maybe Text
instanceIdentityDocumentSignature} -> Maybe Text
instanceIdentityDocumentSignature) (\s :: RegisterContainerInstance
s@RegisterContainerInstance' {} Maybe Text
a -> RegisterContainerInstance
s {$sel:instanceIdentityDocumentSignature:RegisterContainerInstance' :: Maybe Text
instanceIdentityDocumentSignature = Maybe Text
a} :: RegisterContainerInstance)

-- | The short name or full Amazon Resource Name (ARN) of the cluster with
-- which to register your container instance. If you do not specify a
-- cluster, the default cluster is assumed.
registerContainerInstance_cluster :: Lens.Lens' RegisterContainerInstance (Prelude.Maybe Prelude.Text)
registerContainerInstance_cluster :: (Maybe Text -> f (Maybe Text))
-> RegisterContainerInstance -> f RegisterContainerInstance
registerContainerInstance_cluster = (RegisterContainerInstance -> Maybe Text)
-> (RegisterContainerInstance
    -> Maybe Text -> RegisterContainerInstance)
-> Lens
     RegisterContainerInstance
     RegisterContainerInstance
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterContainerInstance' {Maybe Text
cluster :: Maybe Text
$sel:cluster:RegisterContainerInstance' :: RegisterContainerInstance -> Maybe Text
cluster} -> Maybe Text
cluster) (\s :: RegisterContainerInstance
s@RegisterContainerInstance' {} Maybe Text
a -> RegisterContainerInstance
s {$sel:cluster:RegisterContainerInstance' :: Maybe Text
cluster = Maybe Text
a} :: RegisterContainerInstance)

-- | The instance identity document for the EC2 instance to register. This
-- document can be found by running the following command from the
-- instance:
-- @curl http:\/\/169.254.169.254\/latest\/dynamic\/instance-identity\/document\/@
registerContainerInstance_instanceIdentityDocument :: Lens.Lens' RegisterContainerInstance (Prelude.Maybe Prelude.Text)
registerContainerInstance_instanceIdentityDocument :: (Maybe Text -> f (Maybe Text))
-> RegisterContainerInstance -> f RegisterContainerInstance
registerContainerInstance_instanceIdentityDocument = (RegisterContainerInstance -> Maybe Text)
-> (RegisterContainerInstance
    -> Maybe Text -> RegisterContainerInstance)
-> Lens
     RegisterContainerInstance
     RegisterContainerInstance
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterContainerInstance' {Maybe Text
instanceIdentityDocument :: Maybe Text
$sel:instanceIdentityDocument:RegisterContainerInstance' :: RegisterContainerInstance -> Maybe Text
instanceIdentityDocument} -> Maybe Text
instanceIdentityDocument) (\s :: RegisterContainerInstance
s@RegisterContainerInstance' {} Maybe Text
a -> RegisterContainerInstance
s {$sel:instanceIdentityDocument:RegisterContainerInstance' :: Maybe Text
instanceIdentityDocument = Maybe Text
a} :: RegisterContainerInstance)

-- | The ARN of the container instance (if it was previously registered).
registerContainerInstance_containerInstanceArn :: Lens.Lens' RegisterContainerInstance (Prelude.Maybe Prelude.Text)
registerContainerInstance_containerInstanceArn :: (Maybe Text -> f (Maybe Text))
-> RegisterContainerInstance -> f RegisterContainerInstance
registerContainerInstance_containerInstanceArn = (RegisterContainerInstance -> Maybe Text)
-> (RegisterContainerInstance
    -> Maybe Text -> RegisterContainerInstance)
-> Lens
     RegisterContainerInstance
     RegisterContainerInstance
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterContainerInstance' {Maybe Text
containerInstanceArn :: Maybe Text
$sel:containerInstanceArn:RegisterContainerInstance' :: RegisterContainerInstance -> Maybe Text
containerInstanceArn} -> Maybe Text
containerInstanceArn) (\s :: RegisterContainerInstance
s@RegisterContainerInstance' {} Maybe Text
a -> RegisterContainerInstance
s {$sel:containerInstanceArn:RegisterContainerInstance' :: Maybe Text
containerInstanceArn = Maybe Text
a} :: RegisterContainerInstance)

-- | The version information for the Amazon ECS container agent and Docker
-- daemon running on the container instance.
registerContainerInstance_versionInfo :: Lens.Lens' RegisterContainerInstance (Prelude.Maybe VersionInfo)
registerContainerInstance_versionInfo :: (Maybe VersionInfo -> f (Maybe VersionInfo))
-> RegisterContainerInstance -> f RegisterContainerInstance
registerContainerInstance_versionInfo = (RegisterContainerInstance -> Maybe VersionInfo)
-> (RegisterContainerInstance
    -> Maybe VersionInfo -> RegisterContainerInstance)
-> Lens
     RegisterContainerInstance
     RegisterContainerInstance
     (Maybe VersionInfo)
     (Maybe VersionInfo)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterContainerInstance' {Maybe VersionInfo
versionInfo :: Maybe VersionInfo
$sel:versionInfo:RegisterContainerInstance' :: RegisterContainerInstance -> Maybe VersionInfo
versionInfo} -> Maybe VersionInfo
versionInfo) (\s :: RegisterContainerInstance
s@RegisterContainerInstance' {} Maybe VersionInfo
a -> RegisterContainerInstance
s {$sel:versionInfo:RegisterContainerInstance' :: Maybe VersionInfo
versionInfo = Maybe VersionInfo
a} :: RegisterContainerInstance)

-- | The container instance attributes that this container instance supports.
registerContainerInstance_attributes :: Lens.Lens' RegisterContainerInstance (Prelude.Maybe [Attribute])
registerContainerInstance_attributes :: (Maybe [Attribute] -> f (Maybe [Attribute]))
-> RegisterContainerInstance -> f RegisterContainerInstance
registerContainerInstance_attributes = (RegisterContainerInstance -> Maybe [Attribute])
-> (RegisterContainerInstance
    -> Maybe [Attribute] -> RegisterContainerInstance)
-> Lens
     RegisterContainerInstance
     RegisterContainerInstance
     (Maybe [Attribute])
     (Maybe [Attribute])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterContainerInstance' {Maybe [Attribute]
attributes :: Maybe [Attribute]
$sel:attributes:RegisterContainerInstance' :: RegisterContainerInstance -> Maybe [Attribute]
attributes} -> Maybe [Attribute]
attributes) (\s :: RegisterContainerInstance
s@RegisterContainerInstance' {} Maybe [Attribute]
a -> RegisterContainerInstance
s {$sel:attributes:RegisterContainerInstance' :: Maybe [Attribute]
attributes = Maybe [Attribute]
a} :: RegisterContainerInstance) ((Maybe [Attribute] -> f (Maybe [Attribute]))
 -> RegisterContainerInstance -> f RegisterContainerInstance)
-> ((Maybe [Attribute] -> f (Maybe [Attribute]))
    -> Maybe [Attribute] -> f (Maybe [Attribute]))
-> (Maybe [Attribute] -> f (Maybe [Attribute]))
-> RegisterContainerInstance
-> f RegisterContainerInstance
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Attribute] [Attribute] [Attribute] [Attribute]
-> Iso
     (Maybe [Attribute])
     (Maybe [Attribute])
     (Maybe [Attribute])
     (Maybe [Attribute])
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 [Attribute] [Attribute] [Attribute] [Attribute]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The resources available on the instance.
registerContainerInstance_totalResources :: Lens.Lens' RegisterContainerInstance (Prelude.Maybe [Resource])
registerContainerInstance_totalResources :: (Maybe [Resource] -> f (Maybe [Resource]))
-> RegisterContainerInstance -> f RegisterContainerInstance
registerContainerInstance_totalResources = (RegisterContainerInstance -> Maybe [Resource])
-> (RegisterContainerInstance
    -> Maybe [Resource] -> RegisterContainerInstance)
-> Lens
     RegisterContainerInstance
     RegisterContainerInstance
     (Maybe [Resource])
     (Maybe [Resource])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterContainerInstance' {Maybe [Resource]
totalResources :: Maybe [Resource]
$sel:totalResources:RegisterContainerInstance' :: RegisterContainerInstance -> Maybe [Resource]
totalResources} -> Maybe [Resource]
totalResources) (\s :: RegisterContainerInstance
s@RegisterContainerInstance' {} Maybe [Resource]
a -> RegisterContainerInstance
s {$sel:totalResources:RegisterContainerInstance' :: Maybe [Resource]
totalResources = Maybe [Resource]
a} :: RegisterContainerInstance) ((Maybe [Resource] -> f (Maybe [Resource]))
 -> RegisterContainerInstance -> f RegisterContainerInstance)
-> ((Maybe [Resource] -> f (Maybe [Resource]))
    -> Maybe [Resource] -> f (Maybe [Resource]))
-> (Maybe [Resource] -> f (Maybe [Resource]))
-> RegisterContainerInstance
-> f RegisterContainerInstance
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Resource] [Resource] [Resource] [Resource]
-> Iso
     (Maybe [Resource])
     (Maybe [Resource])
     (Maybe [Resource])
     (Maybe [Resource])
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 [Resource] [Resource] [Resource] [Resource]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The metadata that you apply to the container instance to help you
-- categorize and organize them. Each tag consists of a key and an optional
-- value, both of which you define.
--
-- The following basic restrictions apply to tags:
--
-- -   Maximum number of tags per resource - 50
--
-- -   For each resource, each tag key must be unique, and each tag key can
--     have only one value.
--
-- -   Maximum key length - 128 Unicode characters in UTF-8
--
-- -   Maximum value length - 256 Unicode characters in UTF-8
--
-- -   If your tagging schema is used across multiple services and
--     resources, remember that other services may have restrictions on
--     allowed characters. Generally allowed characters are: letters,
--     numbers, and spaces representable in UTF-8, and the following
--     characters: + - = . _ : \/ \@.
--
-- -   Tag keys and values are case-sensitive.
--
-- -   Do not use @aws:@, @AWS:@, or any upper or lowercase combination of
--     such as a prefix for either keys or values as it is reserved for
--     Amazon Web Services use. You cannot edit or delete tag keys or
--     values with this prefix. Tags with this prefix do not count against
--     your tags per resource limit.
registerContainerInstance_tags :: Lens.Lens' RegisterContainerInstance (Prelude.Maybe [Tag])
registerContainerInstance_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> RegisterContainerInstance -> f RegisterContainerInstance
registerContainerInstance_tags = (RegisterContainerInstance -> Maybe [Tag])
-> (RegisterContainerInstance
    -> Maybe [Tag] -> RegisterContainerInstance)
-> Lens
     RegisterContainerInstance
     RegisterContainerInstance
     (Maybe [Tag])
     (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterContainerInstance' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:RegisterContainerInstance' :: RegisterContainerInstance -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: RegisterContainerInstance
s@RegisterContainerInstance' {} Maybe [Tag]
a -> RegisterContainerInstance
s {$sel:tags:RegisterContainerInstance' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: RegisterContainerInstance) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> RegisterContainerInstance -> f RegisterContainerInstance)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> RegisterContainerInstance
-> f RegisterContainerInstance
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
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 [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData RegisterContainerInstance

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

instance Core.ToJSON RegisterContainerInstance where
  toJSON :: RegisterContainerInstance -> Value
toJSON RegisterContainerInstance' {Maybe [PlatformDevice]
Maybe [Resource]
Maybe [Tag]
Maybe [Attribute]
Maybe Text
Maybe VersionInfo
tags :: Maybe [Tag]
totalResources :: Maybe [Resource]
attributes :: Maybe [Attribute]
versionInfo :: Maybe VersionInfo
containerInstanceArn :: Maybe Text
instanceIdentityDocument :: Maybe Text
cluster :: Maybe Text
instanceIdentityDocumentSignature :: Maybe Text
platformDevices :: Maybe [PlatformDevice]
$sel:tags:RegisterContainerInstance' :: RegisterContainerInstance -> Maybe [Tag]
$sel:totalResources:RegisterContainerInstance' :: RegisterContainerInstance -> Maybe [Resource]
$sel:attributes:RegisterContainerInstance' :: RegisterContainerInstance -> Maybe [Attribute]
$sel:versionInfo:RegisterContainerInstance' :: RegisterContainerInstance -> Maybe VersionInfo
$sel:containerInstanceArn:RegisterContainerInstance' :: RegisterContainerInstance -> Maybe Text
$sel:instanceIdentityDocument:RegisterContainerInstance' :: RegisterContainerInstance -> Maybe Text
$sel:cluster:RegisterContainerInstance' :: RegisterContainerInstance -> Maybe Text
$sel:instanceIdentityDocumentSignature:RegisterContainerInstance' :: RegisterContainerInstance -> Maybe Text
$sel:platformDevices:RegisterContainerInstance' :: RegisterContainerInstance -> Maybe [PlatformDevice]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"platformDevices" Text -> [PlatformDevice] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([PlatformDevice] -> Pair) -> Maybe [PlatformDevice] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [PlatformDevice]
platformDevices,
            (Text
"instanceIdentityDocumentSignature" 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
instanceIdentityDocumentSignature,
            (Text
"cluster" 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
cluster,
            (Text
"instanceIdentityDocument" 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
instanceIdentityDocument,
            (Text
"containerInstanceArn" 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
containerInstanceArn,
            (Text
"versionInfo" Text -> VersionInfo -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (VersionInfo -> Pair) -> Maybe VersionInfo -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe VersionInfo
versionInfo,
            (Text
"attributes" Text -> [Attribute] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Attribute] -> Pair) -> Maybe [Attribute] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Attribute]
attributes,
            (Text
"totalResources" Text -> [Resource] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([Resource] -> Pair) -> Maybe [Resource] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Resource]
totalResources,
            (Text
"tags" Text -> [Tag] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Tag] -> Pair) -> Maybe [Tag] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags
          ]
      )

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

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

-- | /See:/ 'newRegisterContainerInstanceResponse' smart constructor.
data RegisterContainerInstanceResponse = RegisterContainerInstanceResponse'
  { -- | The container instance that was registered.
    RegisterContainerInstanceResponse -> Maybe ContainerInstance
containerInstance :: Prelude.Maybe ContainerInstance,
    -- | The response's http status code.
    RegisterContainerInstanceResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (RegisterContainerInstanceResponse
-> RegisterContainerInstanceResponse -> Bool
(RegisterContainerInstanceResponse
 -> RegisterContainerInstanceResponse -> Bool)
-> (RegisterContainerInstanceResponse
    -> RegisterContainerInstanceResponse -> Bool)
-> Eq RegisterContainerInstanceResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RegisterContainerInstanceResponse
-> RegisterContainerInstanceResponse -> Bool
$c/= :: RegisterContainerInstanceResponse
-> RegisterContainerInstanceResponse -> Bool
== :: RegisterContainerInstanceResponse
-> RegisterContainerInstanceResponse -> Bool
$c== :: RegisterContainerInstanceResponse
-> RegisterContainerInstanceResponse -> Bool
Prelude.Eq, ReadPrec [RegisterContainerInstanceResponse]
ReadPrec RegisterContainerInstanceResponse
Int -> ReadS RegisterContainerInstanceResponse
ReadS [RegisterContainerInstanceResponse]
(Int -> ReadS RegisterContainerInstanceResponse)
-> ReadS [RegisterContainerInstanceResponse]
-> ReadPrec RegisterContainerInstanceResponse
-> ReadPrec [RegisterContainerInstanceResponse]
-> Read RegisterContainerInstanceResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RegisterContainerInstanceResponse]
$creadListPrec :: ReadPrec [RegisterContainerInstanceResponse]
readPrec :: ReadPrec RegisterContainerInstanceResponse
$creadPrec :: ReadPrec RegisterContainerInstanceResponse
readList :: ReadS [RegisterContainerInstanceResponse]
$creadList :: ReadS [RegisterContainerInstanceResponse]
readsPrec :: Int -> ReadS RegisterContainerInstanceResponse
$creadsPrec :: Int -> ReadS RegisterContainerInstanceResponse
Prelude.Read, Int -> RegisterContainerInstanceResponse -> ShowS
[RegisterContainerInstanceResponse] -> ShowS
RegisterContainerInstanceResponse -> String
(Int -> RegisterContainerInstanceResponse -> ShowS)
-> (RegisterContainerInstanceResponse -> String)
-> ([RegisterContainerInstanceResponse] -> ShowS)
-> Show RegisterContainerInstanceResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RegisterContainerInstanceResponse] -> ShowS
$cshowList :: [RegisterContainerInstanceResponse] -> ShowS
show :: RegisterContainerInstanceResponse -> String
$cshow :: RegisterContainerInstanceResponse -> String
showsPrec :: Int -> RegisterContainerInstanceResponse -> ShowS
$cshowsPrec :: Int -> RegisterContainerInstanceResponse -> ShowS
Prelude.Show, (forall x.
 RegisterContainerInstanceResponse
 -> Rep RegisterContainerInstanceResponse x)
-> (forall x.
    Rep RegisterContainerInstanceResponse x
    -> RegisterContainerInstanceResponse)
-> Generic RegisterContainerInstanceResponse
forall x.
Rep RegisterContainerInstanceResponse x
-> RegisterContainerInstanceResponse
forall x.
RegisterContainerInstanceResponse
-> Rep RegisterContainerInstanceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RegisterContainerInstanceResponse x
-> RegisterContainerInstanceResponse
$cfrom :: forall x.
RegisterContainerInstanceResponse
-> Rep RegisterContainerInstanceResponse x
Prelude.Generic)

-- |
-- Create a value of 'RegisterContainerInstanceResponse' 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:
--
-- 'containerInstance', 'registerContainerInstanceResponse_containerInstance' - The container instance that was registered.
--
-- 'httpStatus', 'registerContainerInstanceResponse_httpStatus' - The response's http status code.
newRegisterContainerInstanceResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  RegisterContainerInstanceResponse
newRegisterContainerInstanceResponse :: Int -> RegisterContainerInstanceResponse
newRegisterContainerInstanceResponse Int
pHttpStatus_ =
  RegisterContainerInstanceResponse' :: Maybe ContainerInstance -> Int -> RegisterContainerInstanceResponse
RegisterContainerInstanceResponse'
    { $sel:containerInstance:RegisterContainerInstanceResponse' :: Maybe ContainerInstance
containerInstance =
        Maybe ContainerInstance
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:RegisterContainerInstanceResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The container instance that was registered.
registerContainerInstanceResponse_containerInstance :: Lens.Lens' RegisterContainerInstanceResponse (Prelude.Maybe ContainerInstance)
registerContainerInstanceResponse_containerInstance :: (Maybe ContainerInstance -> f (Maybe ContainerInstance))
-> RegisterContainerInstanceResponse
-> f RegisterContainerInstanceResponse
registerContainerInstanceResponse_containerInstance = (RegisterContainerInstanceResponse -> Maybe ContainerInstance)
-> (RegisterContainerInstanceResponse
    -> Maybe ContainerInstance -> RegisterContainerInstanceResponse)
-> Lens
     RegisterContainerInstanceResponse
     RegisterContainerInstanceResponse
     (Maybe ContainerInstance)
     (Maybe ContainerInstance)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterContainerInstanceResponse' {Maybe ContainerInstance
containerInstance :: Maybe ContainerInstance
$sel:containerInstance:RegisterContainerInstanceResponse' :: RegisterContainerInstanceResponse -> Maybe ContainerInstance
containerInstance} -> Maybe ContainerInstance
containerInstance) (\s :: RegisterContainerInstanceResponse
s@RegisterContainerInstanceResponse' {} Maybe ContainerInstance
a -> RegisterContainerInstanceResponse
s {$sel:containerInstance:RegisterContainerInstanceResponse' :: Maybe ContainerInstance
containerInstance = Maybe ContainerInstance
a} :: RegisterContainerInstanceResponse)

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

instance
  Prelude.NFData
    RegisterContainerInstanceResponse