{-# 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.OpsWorks.RegisterInstance
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Registers instances that were created outside of AWS OpsWorks Stacks
-- with a specified stack.
--
-- We do not recommend using this action to register instances. The
-- complete registration operation includes two tasks: installing the AWS
-- OpsWorks Stacks agent on the instance, and registering the instance with
-- the stack. @RegisterInstance@ handles only the second step. You should
-- instead use the AWS CLI @register@ command, which performs the entire
-- registration operation. For more information, see
-- <https://docs.aws.amazon.com/opsworks/latest/userguide/registered-instances-register.html Registering an Instance with an AWS OpsWorks Stacks Stack>.
--
-- Registered instances have the same requirements as instances that are
-- created by using the CreateInstance API. For example, registered
-- instances must be running a supported Linux-based operating system, and
-- they must have a supported instance type. For more information about
-- requirements for instances that you want to register, see
-- <https://docs.aws.amazon.com/opsworks/latest/userguide/registered-instances-register-registering-preparer.html Preparing the Instance>.
--
-- __Required Permissions__: To use this action, an IAM user must have a
-- Manage permissions level for the stack or an attached policy that
-- explicitly grants permissions. For more information on user permissions,
-- see
-- <https://docs.aws.amazon.com/opsworks/latest/userguide/opsworks-security-users.html Managing User Permissions>.
module Amazonka.OpsWorks.RegisterInstance
  ( -- * Creating a Request
    RegisterInstance (..),
    newRegisterInstance,

    -- * Request Lenses
    registerInstance_hostname,
    registerInstance_instanceIdentity,
    registerInstance_privateIp,
    registerInstance_publicIp,
    registerInstance_rsaPublicKey,
    registerInstance_rsaPublicKeyFingerprint,
    registerInstance_stackId,

    -- * Destructuring the Response
    RegisterInstanceResponse (..),
    newRegisterInstanceResponse,

    -- * Response Lenses
    registerInstanceResponse_instanceId,
    registerInstanceResponse_httpStatus,
  )
where

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

-- | /See:/ 'newRegisterInstance' smart constructor.
data RegisterInstance = RegisterInstance'
  { -- | The instance\'s hostname.
    RegisterInstance -> Maybe Text
hostname :: Prelude.Maybe Prelude.Text,
    -- | An InstanceIdentity object that contains the instance\'s identity.
    RegisterInstance -> Maybe InstanceIdentity
instanceIdentity :: Prelude.Maybe InstanceIdentity,
    -- | The instance\'s private IP address.
    RegisterInstance -> Maybe Text
privateIp :: Prelude.Maybe Prelude.Text,
    -- | The instance\'s public IP address.
    RegisterInstance -> Maybe Text
publicIp :: Prelude.Maybe Prelude.Text,
    -- | The instances public RSA key. This key is used to encrypt communication
    -- between the instance and the service.
    RegisterInstance -> Maybe Text
rsaPublicKey :: Prelude.Maybe Prelude.Text,
    -- | The instances public RSA key fingerprint.
    RegisterInstance -> Maybe Text
rsaPublicKeyFingerprint :: Prelude.Maybe Prelude.Text,
    -- | The ID of the stack that the instance is to be registered with.
    RegisterInstance -> Text
stackId :: Prelude.Text
  }
  deriving (RegisterInstance -> RegisterInstance -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RegisterInstance -> RegisterInstance -> Bool
$c/= :: RegisterInstance -> RegisterInstance -> Bool
== :: RegisterInstance -> RegisterInstance -> Bool
$c== :: RegisterInstance -> RegisterInstance -> Bool
Prelude.Eq, ReadPrec [RegisterInstance]
ReadPrec RegisterInstance
Int -> ReadS RegisterInstance
ReadS [RegisterInstance]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RegisterInstance]
$creadListPrec :: ReadPrec [RegisterInstance]
readPrec :: ReadPrec RegisterInstance
$creadPrec :: ReadPrec RegisterInstance
readList :: ReadS [RegisterInstance]
$creadList :: ReadS [RegisterInstance]
readsPrec :: Int -> ReadS RegisterInstance
$creadsPrec :: Int -> ReadS RegisterInstance
Prelude.Read, Int -> RegisterInstance -> ShowS
[RegisterInstance] -> ShowS
RegisterInstance -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RegisterInstance] -> ShowS
$cshowList :: [RegisterInstance] -> ShowS
show :: RegisterInstance -> String
$cshow :: RegisterInstance -> String
showsPrec :: Int -> RegisterInstance -> ShowS
$cshowsPrec :: Int -> RegisterInstance -> ShowS
Prelude.Show, forall x. Rep RegisterInstance x -> RegisterInstance
forall x. RegisterInstance -> Rep RegisterInstance x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RegisterInstance x -> RegisterInstance
$cfrom :: forall x. RegisterInstance -> Rep RegisterInstance x
Prelude.Generic)

-- |
-- Create a value of 'RegisterInstance' 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:
--
-- 'hostname', 'registerInstance_hostname' - The instance\'s hostname.
--
-- 'instanceIdentity', 'registerInstance_instanceIdentity' - An InstanceIdentity object that contains the instance\'s identity.
--
-- 'privateIp', 'registerInstance_privateIp' - The instance\'s private IP address.
--
-- 'publicIp', 'registerInstance_publicIp' - The instance\'s public IP address.
--
-- 'rsaPublicKey', 'registerInstance_rsaPublicKey' - The instances public RSA key. This key is used to encrypt communication
-- between the instance and the service.
--
-- 'rsaPublicKeyFingerprint', 'registerInstance_rsaPublicKeyFingerprint' - The instances public RSA key fingerprint.
--
-- 'stackId', 'registerInstance_stackId' - The ID of the stack that the instance is to be registered with.
newRegisterInstance ::
  -- | 'stackId'
  Prelude.Text ->
  RegisterInstance
newRegisterInstance :: Text -> RegisterInstance
newRegisterInstance Text
pStackId_ =
  RegisterInstance'
    { $sel:hostname:RegisterInstance' :: Maybe Text
hostname = forall a. Maybe a
Prelude.Nothing,
      $sel:instanceIdentity:RegisterInstance' :: Maybe InstanceIdentity
instanceIdentity = forall a. Maybe a
Prelude.Nothing,
      $sel:privateIp:RegisterInstance' :: Maybe Text
privateIp = forall a. Maybe a
Prelude.Nothing,
      $sel:publicIp:RegisterInstance' :: Maybe Text
publicIp = forall a. Maybe a
Prelude.Nothing,
      $sel:rsaPublicKey:RegisterInstance' :: Maybe Text
rsaPublicKey = forall a. Maybe a
Prelude.Nothing,
      $sel:rsaPublicKeyFingerprint:RegisterInstance' :: Maybe Text
rsaPublicKeyFingerprint = forall a. Maybe a
Prelude.Nothing,
      $sel:stackId:RegisterInstance' :: Text
stackId = Text
pStackId_
    }

-- | The instance\'s hostname.
registerInstance_hostname :: Lens.Lens' RegisterInstance (Prelude.Maybe Prelude.Text)
registerInstance_hostname :: Lens' RegisterInstance (Maybe Text)
registerInstance_hostname = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterInstance' {Maybe Text
hostname :: Maybe Text
$sel:hostname:RegisterInstance' :: RegisterInstance -> Maybe Text
hostname} -> Maybe Text
hostname) (\s :: RegisterInstance
s@RegisterInstance' {} Maybe Text
a -> RegisterInstance
s {$sel:hostname:RegisterInstance' :: Maybe Text
hostname = Maybe Text
a} :: RegisterInstance)

-- | An InstanceIdentity object that contains the instance\'s identity.
registerInstance_instanceIdentity :: Lens.Lens' RegisterInstance (Prelude.Maybe InstanceIdentity)
registerInstance_instanceIdentity :: Lens' RegisterInstance (Maybe InstanceIdentity)
registerInstance_instanceIdentity = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterInstance' {Maybe InstanceIdentity
instanceIdentity :: Maybe InstanceIdentity
$sel:instanceIdentity:RegisterInstance' :: RegisterInstance -> Maybe InstanceIdentity
instanceIdentity} -> Maybe InstanceIdentity
instanceIdentity) (\s :: RegisterInstance
s@RegisterInstance' {} Maybe InstanceIdentity
a -> RegisterInstance
s {$sel:instanceIdentity:RegisterInstance' :: Maybe InstanceIdentity
instanceIdentity = Maybe InstanceIdentity
a} :: RegisterInstance)

-- | The instance\'s private IP address.
registerInstance_privateIp :: Lens.Lens' RegisterInstance (Prelude.Maybe Prelude.Text)
registerInstance_privateIp :: Lens' RegisterInstance (Maybe Text)
registerInstance_privateIp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterInstance' {Maybe Text
privateIp :: Maybe Text
$sel:privateIp:RegisterInstance' :: RegisterInstance -> Maybe Text
privateIp} -> Maybe Text
privateIp) (\s :: RegisterInstance
s@RegisterInstance' {} Maybe Text
a -> RegisterInstance
s {$sel:privateIp:RegisterInstance' :: Maybe Text
privateIp = Maybe Text
a} :: RegisterInstance)

-- | The instance\'s public IP address.
registerInstance_publicIp :: Lens.Lens' RegisterInstance (Prelude.Maybe Prelude.Text)
registerInstance_publicIp :: Lens' RegisterInstance (Maybe Text)
registerInstance_publicIp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterInstance' {Maybe Text
publicIp :: Maybe Text
$sel:publicIp:RegisterInstance' :: RegisterInstance -> Maybe Text
publicIp} -> Maybe Text
publicIp) (\s :: RegisterInstance
s@RegisterInstance' {} Maybe Text
a -> RegisterInstance
s {$sel:publicIp:RegisterInstance' :: Maybe Text
publicIp = Maybe Text
a} :: RegisterInstance)

-- | The instances public RSA key. This key is used to encrypt communication
-- between the instance and the service.
registerInstance_rsaPublicKey :: Lens.Lens' RegisterInstance (Prelude.Maybe Prelude.Text)
registerInstance_rsaPublicKey :: Lens' RegisterInstance (Maybe Text)
registerInstance_rsaPublicKey = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterInstance' {Maybe Text
rsaPublicKey :: Maybe Text
$sel:rsaPublicKey:RegisterInstance' :: RegisterInstance -> Maybe Text
rsaPublicKey} -> Maybe Text
rsaPublicKey) (\s :: RegisterInstance
s@RegisterInstance' {} Maybe Text
a -> RegisterInstance
s {$sel:rsaPublicKey:RegisterInstance' :: Maybe Text
rsaPublicKey = Maybe Text
a} :: RegisterInstance)

-- | The instances public RSA key fingerprint.
registerInstance_rsaPublicKeyFingerprint :: Lens.Lens' RegisterInstance (Prelude.Maybe Prelude.Text)
registerInstance_rsaPublicKeyFingerprint :: Lens' RegisterInstance (Maybe Text)
registerInstance_rsaPublicKeyFingerprint = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterInstance' {Maybe Text
rsaPublicKeyFingerprint :: Maybe Text
$sel:rsaPublicKeyFingerprint:RegisterInstance' :: RegisterInstance -> Maybe Text
rsaPublicKeyFingerprint} -> Maybe Text
rsaPublicKeyFingerprint) (\s :: RegisterInstance
s@RegisterInstance' {} Maybe Text
a -> RegisterInstance
s {$sel:rsaPublicKeyFingerprint:RegisterInstance' :: Maybe Text
rsaPublicKeyFingerprint = Maybe Text
a} :: RegisterInstance)

-- | The ID of the stack that the instance is to be registered with.
registerInstance_stackId :: Lens.Lens' RegisterInstance Prelude.Text
registerInstance_stackId :: Lens' RegisterInstance Text
registerInstance_stackId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterInstance' {Text
stackId :: Text
$sel:stackId:RegisterInstance' :: RegisterInstance -> Text
stackId} -> Text
stackId) (\s :: RegisterInstance
s@RegisterInstance' {} Text
a -> RegisterInstance
s {$sel:stackId:RegisterInstance' :: Text
stackId = Text
a} :: RegisterInstance)

instance Core.AWSRequest RegisterInstance where
  type
    AWSResponse RegisterInstance =
      RegisterInstanceResponse
  request :: (Service -> Service)
-> RegisterInstance -> Request RegisterInstance
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy RegisterInstance
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse RegisterInstance)))
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 -> Int -> RegisterInstanceResponse
RegisterInstanceResponse'
            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
"InstanceId")
            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 RegisterInstance where
  hashWithSalt :: Int -> RegisterInstance -> Int
hashWithSalt Int
_salt RegisterInstance' {Maybe Text
Maybe InstanceIdentity
Text
stackId :: Text
rsaPublicKeyFingerprint :: Maybe Text
rsaPublicKey :: Maybe Text
publicIp :: Maybe Text
privateIp :: Maybe Text
instanceIdentity :: Maybe InstanceIdentity
hostname :: Maybe Text
$sel:stackId:RegisterInstance' :: RegisterInstance -> Text
$sel:rsaPublicKeyFingerprint:RegisterInstance' :: RegisterInstance -> Maybe Text
$sel:rsaPublicKey:RegisterInstance' :: RegisterInstance -> Maybe Text
$sel:publicIp:RegisterInstance' :: RegisterInstance -> Maybe Text
$sel:privateIp:RegisterInstance' :: RegisterInstance -> Maybe Text
$sel:instanceIdentity:RegisterInstance' :: RegisterInstance -> Maybe InstanceIdentity
$sel:hostname:RegisterInstance' :: RegisterInstance -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
hostname
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe InstanceIdentity
instanceIdentity
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
privateIp
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
publicIp
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
rsaPublicKey
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
rsaPublicKeyFingerprint
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
stackId

instance Prelude.NFData RegisterInstance where
  rnf :: RegisterInstance -> ()
rnf RegisterInstance' {Maybe Text
Maybe InstanceIdentity
Text
stackId :: Text
rsaPublicKeyFingerprint :: Maybe Text
rsaPublicKey :: Maybe Text
publicIp :: Maybe Text
privateIp :: Maybe Text
instanceIdentity :: Maybe InstanceIdentity
hostname :: Maybe Text
$sel:stackId:RegisterInstance' :: RegisterInstance -> Text
$sel:rsaPublicKeyFingerprint:RegisterInstance' :: RegisterInstance -> Maybe Text
$sel:rsaPublicKey:RegisterInstance' :: RegisterInstance -> Maybe Text
$sel:publicIp:RegisterInstance' :: RegisterInstance -> Maybe Text
$sel:privateIp:RegisterInstance' :: RegisterInstance -> Maybe Text
$sel:instanceIdentity:RegisterInstance' :: RegisterInstance -> Maybe InstanceIdentity
$sel:hostname:RegisterInstance' :: RegisterInstance -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
hostname
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe InstanceIdentity
instanceIdentity
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
privateIp
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
publicIp
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
rsaPublicKey
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
rsaPublicKeyFingerprint
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
stackId

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

instance Data.ToJSON RegisterInstance where
  toJSON :: RegisterInstance -> Value
toJSON RegisterInstance' {Maybe Text
Maybe InstanceIdentity
Text
stackId :: Text
rsaPublicKeyFingerprint :: Maybe Text
rsaPublicKey :: Maybe Text
publicIp :: Maybe Text
privateIp :: Maybe Text
instanceIdentity :: Maybe InstanceIdentity
hostname :: Maybe Text
$sel:stackId:RegisterInstance' :: RegisterInstance -> Text
$sel:rsaPublicKeyFingerprint:RegisterInstance' :: RegisterInstance -> Maybe Text
$sel:rsaPublicKey:RegisterInstance' :: RegisterInstance -> Maybe Text
$sel:publicIp:RegisterInstance' :: RegisterInstance -> Maybe Text
$sel:privateIp:RegisterInstance' :: RegisterInstance -> Maybe Text
$sel:instanceIdentity:RegisterInstance' :: RegisterInstance -> Maybe InstanceIdentity
$sel:hostname:RegisterInstance' :: RegisterInstance -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"Hostname" 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
hostname,
            (Key
"InstanceIdentity" 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 InstanceIdentity
instanceIdentity,
            (Key
"PrivateIp" 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
privateIp,
            (Key
"PublicIp" 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
publicIp,
            (Key
"RsaPublicKey" 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
rsaPublicKey,
            (Key
"RsaPublicKeyFingerprint" 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
rsaPublicKeyFingerprint,
            forall a. a -> Maybe a
Prelude.Just (Key
"StackId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
stackId)
          ]
      )

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

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

-- | Contains the response to a @RegisterInstanceResult@ request.
--
-- /See:/ 'newRegisterInstanceResponse' smart constructor.
data RegisterInstanceResponse = RegisterInstanceResponse'
  { -- | The registered instance\'s AWS OpsWorks Stacks ID.
    RegisterInstanceResponse -> Maybe Text
instanceId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    RegisterInstanceResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (RegisterInstanceResponse -> RegisterInstanceResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RegisterInstanceResponse -> RegisterInstanceResponse -> Bool
$c/= :: RegisterInstanceResponse -> RegisterInstanceResponse -> Bool
== :: RegisterInstanceResponse -> RegisterInstanceResponse -> Bool
$c== :: RegisterInstanceResponse -> RegisterInstanceResponse -> Bool
Prelude.Eq, ReadPrec [RegisterInstanceResponse]
ReadPrec RegisterInstanceResponse
Int -> ReadS RegisterInstanceResponse
ReadS [RegisterInstanceResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RegisterInstanceResponse]
$creadListPrec :: ReadPrec [RegisterInstanceResponse]
readPrec :: ReadPrec RegisterInstanceResponse
$creadPrec :: ReadPrec RegisterInstanceResponse
readList :: ReadS [RegisterInstanceResponse]
$creadList :: ReadS [RegisterInstanceResponse]
readsPrec :: Int -> ReadS RegisterInstanceResponse
$creadsPrec :: Int -> ReadS RegisterInstanceResponse
Prelude.Read, Int -> RegisterInstanceResponse -> ShowS
[RegisterInstanceResponse] -> ShowS
RegisterInstanceResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RegisterInstanceResponse] -> ShowS
$cshowList :: [RegisterInstanceResponse] -> ShowS
show :: RegisterInstanceResponse -> String
$cshow :: RegisterInstanceResponse -> String
showsPrec :: Int -> RegisterInstanceResponse -> ShowS
$cshowsPrec :: Int -> RegisterInstanceResponse -> ShowS
Prelude.Show, forall x.
Rep RegisterInstanceResponse x -> RegisterInstanceResponse
forall x.
RegisterInstanceResponse -> Rep RegisterInstanceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RegisterInstanceResponse x -> RegisterInstanceResponse
$cfrom :: forall x.
RegisterInstanceResponse -> Rep RegisterInstanceResponse x
Prelude.Generic)

-- |
-- Create a value of 'RegisterInstanceResponse' 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:
--
-- 'instanceId', 'registerInstanceResponse_instanceId' - The registered instance\'s AWS OpsWorks Stacks ID.
--
-- 'httpStatus', 'registerInstanceResponse_httpStatus' - The response's http status code.
newRegisterInstanceResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  RegisterInstanceResponse
newRegisterInstanceResponse :: Int -> RegisterInstanceResponse
newRegisterInstanceResponse Int
pHttpStatus_ =
  RegisterInstanceResponse'
    { $sel:instanceId:RegisterInstanceResponse' :: Maybe Text
instanceId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:RegisterInstanceResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The registered instance\'s AWS OpsWorks Stacks ID.
registerInstanceResponse_instanceId :: Lens.Lens' RegisterInstanceResponse (Prelude.Maybe Prelude.Text)
registerInstanceResponse_instanceId :: Lens' RegisterInstanceResponse (Maybe Text)
registerInstanceResponse_instanceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterInstanceResponse' {Maybe Text
instanceId :: Maybe Text
$sel:instanceId:RegisterInstanceResponse' :: RegisterInstanceResponse -> Maybe Text
instanceId} -> Maybe Text
instanceId) (\s :: RegisterInstanceResponse
s@RegisterInstanceResponse' {} Maybe Text
a -> RegisterInstanceResponse
s {$sel:instanceId:RegisterInstanceResponse' :: Maybe Text
instanceId = Maybe Text
a} :: RegisterInstanceResponse)

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

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