{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Lightsail.Types.StaticIp
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Lightsail.Types.StaticIp where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Lightsail.Types.ResourceLocation
import Amazonka.Lightsail.Types.ResourceType
import qualified Amazonka.Prelude as Prelude

-- | Describes a static IP.
--
-- /See:/ 'newStaticIp' smart constructor.
data StaticIp = StaticIp'
  { -- | The Amazon Resource Name (ARN) of the static IP (e.g.,
    -- @arn:aws:lightsail:us-east-2:123456789101:StaticIp\/9cbb4a9e-f8e3-4dfe-b57e-12345EXAMPLE@).
    StaticIp -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The instance where the static IP is attached (e.g.,
    -- @Amazon_Linux-1GB-Ohio-1@).
    StaticIp -> Maybe Text
attachedTo :: Prelude.Maybe Prelude.Text,
    -- | The timestamp when the static IP was created (e.g., @1479735304.222@).
    StaticIp -> Maybe POSIX
createdAt :: Prelude.Maybe Data.POSIX,
    -- | The static IP address.
    StaticIp -> Maybe Text
ipAddress :: Prelude.Maybe Prelude.Text,
    -- | A Boolean value indicating whether the static IP is attached.
    StaticIp -> Maybe Bool
isAttached :: Prelude.Maybe Prelude.Bool,
    -- | The region and Availability Zone where the static IP was created.
    StaticIp -> Maybe ResourceLocation
location :: Prelude.Maybe ResourceLocation,
    -- | The name of the static IP (e.g., @StaticIP-Ohio-EXAMPLE@).
    StaticIp -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The resource type (usually @StaticIp@).
    StaticIp -> Maybe ResourceType
resourceType :: Prelude.Maybe ResourceType,
    -- | The support code. Include this code in your email to support when you
    -- have questions about an instance or another resource in Lightsail. This
    -- code enables our support team to look up your Lightsail information more
    -- easily.
    StaticIp -> Maybe Text
supportCode :: Prelude.Maybe Prelude.Text
  }
  deriving (StaticIp -> StaticIp -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StaticIp -> StaticIp -> Bool
$c/= :: StaticIp -> StaticIp -> Bool
== :: StaticIp -> StaticIp -> Bool
$c== :: StaticIp -> StaticIp -> Bool
Prelude.Eq, ReadPrec [StaticIp]
ReadPrec StaticIp
Int -> ReadS StaticIp
ReadS [StaticIp]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StaticIp]
$creadListPrec :: ReadPrec [StaticIp]
readPrec :: ReadPrec StaticIp
$creadPrec :: ReadPrec StaticIp
readList :: ReadS [StaticIp]
$creadList :: ReadS [StaticIp]
readsPrec :: Int -> ReadS StaticIp
$creadsPrec :: Int -> ReadS StaticIp
Prelude.Read, Int -> StaticIp -> ShowS
[StaticIp] -> ShowS
StaticIp -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StaticIp] -> ShowS
$cshowList :: [StaticIp] -> ShowS
show :: StaticIp -> String
$cshow :: StaticIp -> String
showsPrec :: Int -> StaticIp -> ShowS
$cshowsPrec :: Int -> StaticIp -> ShowS
Prelude.Show, forall x. Rep StaticIp x -> StaticIp
forall x. StaticIp -> Rep StaticIp x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StaticIp x -> StaticIp
$cfrom :: forall x. StaticIp -> Rep StaticIp x
Prelude.Generic)

-- |
-- Create a value of 'StaticIp' 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:
--
-- 'arn', 'staticIp_arn' - The Amazon Resource Name (ARN) of the static IP (e.g.,
-- @arn:aws:lightsail:us-east-2:123456789101:StaticIp\/9cbb4a9e-f8e3-4dfe-b57e-12345EXAMPLE@).
--
-- 'attachedTo', 'staticIp_attachedTo' - The instance where the static IP is attached (e.g.,
-- @Amazon_Linux-1GB-Ohio-1@).
--
-- 'createdAt', 'staticIp_createdAt' - The timestamp when the static IP was created (e.g., @1479735304.222@).
--
-- 'ipAddress', 'staticIp_ipAddress' - The static IP address.
--
-- 'isAttached', 'staticIp_isAttached' - A Boolean value indicating whether the static IP is attached.
--
-- 'location', 'staticIp_location' - The region and Availability Zone where the static IP was created.
--
-- 'name', 'staticIp_name' - The name of the static IP (e.g., @StaticIP-Ohio-EXAMPLE@).
--
-- 'resourceType', 'staticIp_resourceType' - The resource type (usually @StaticIp@).
--
-- 'supportCode', 'staticIp_supportCode' - The support code. Include this code in your email to support when you
-- have questions about an instance or another resource in Lightsail. This
-- code enables our support team to look up your Lightsail information more
-- easily.
newStaticIp ::
  StaticIp
newStaticIp :: StaticIp
newStaticIp =
  StaticIp'
    { $sel:arn:StaticIp' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:attachedTo:StaticIp' :: Maybe Text
attachedTo = forall a. Maybe a
Prelude.Nothing,
      $sel:createdAt:StaticIp' :: Maybe POSIX
createdAt = forall a. Maybe a
Prelude.Nothing,
      $sel:ipAddress:StaticIp' :: Maybe Text
ipAddress = forall a. Maybe a
Prelude.Nothing,
      $sel:isAttached:StaticIp' :: Maybe Bool
isAttached = forall a. Maybe a
Prelude.Nothing,
      $sel:location:StaticIp' :: Maybe ResourceLocation
location = forall a. Maybe a
Prelude.Nothing,
      $sel:name:StaticIp' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:resourceType:StaticIp' :: Maybe ResourceType
resourceType = forall a. Maybe a
Prelude.Nothing,
      $sel:supportCode:StaticIp' :: Maybe Text
supportCode = forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name (ARN) of the static IP (e.g.,
-- @arn:aws:lightsail:us-east-2:123456789101:StaticIp\/9cbb4a9e-f8e3-4dfe-b57e-12345EXAMPLE@).
staticIp_arn :: Lens.Lens' StaticIp (Prelude.Maybe Prelude.Text)
staticIp_arn :: Lens' StaticIp (Maybe Text)
staticIp_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StaticIp' {Maybe Text
arn :: Maybe Text
$sel:arn:StaticIp' :: StaticIp -> Maybe Text
arn} -> Maybe Text
arn) (\s :: StaticIp
s@StaticIp' {} Maybe Text
a -> StaticIp
s {$sel:arn:StaticIp' :: Maybe Text
arn = Maybe Text
a} :: StaticIp)

-- | The instance where the static IP is attached (e.g.,
-- @Amazon_Linux-1GB-Ohio-1@).
staticIp_attachedTo :: Lens.Lens' StaticIp (Prelude.Maybe Prelude.Text)
staticIp_attachedTo :: Lens' StaticIp (Maybe Text)
staticIp_attachedTo = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StaticIp' {Maybe Text
attachedTo :: Maybe Text
$sel:attachedTo:StaticIp' :: StaticIp -> Maybe Text
attachedTo} -> Maybe Text
attachedTo) (\s :: StaticIp
s@StaticIp' {} Maybe Text
a -> StaticIp
s {$sel:attachedTo:StaticIp' :: Maybe Text
attachedTo = Maybe Text
a} :: StaticIp)

-- | The timestamp when the static IP was created (e.g., @1479735304.222@).
staticIp_createdAt :: Lens.Lens' StaticIp (Prelude.Maybe Prelude.UTCTime)
staticIp_createdAt :: Lens' StaticIp (Maybe UTCTime)
staticIp_createdAt = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StaticIp' {Maybe POSIX
createdAt :: Maybe POSIX
$sel:createdAt:StaticIp' :: StaticIp -> Maybe POSIX
createdAt} -> Maybe POSIX
createdAt) (\s :: StaticIp
s@StaticIp' {} Maybe POSIX
a -> StaticIp
s {$sel:createdAt:StaticIp' :: Maybe POSIX
createdAt = Maybe POSIX
a} :: StaticIp) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The static IP address.
staticIp_ipAddress :: Lens.Lens' StaticIp (Prelude.Maybe Prelude.Text)
staticIp_ipAddress :: Lens' StaticIp (Maybe Text)
staticIp_ipAddress = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StaticIp' {Maybe Text
ipAddress :: Maybe Text
$sel:ipAddress:StaticIp' :: StaticIp -> Maybe Text
ipAddress} -> Maybe Text
ipAddress) (\s :: StaticIp
s@StaticIp' {} Maybe Text
a -> StaticIp
s {$sel:ipAddress:StaticIp' :: Maybe Text
ipAddress = Maybe Text
a} :: StaticIp)

-- | A Boolean value indicating whether the static IP is attached.
staticIp_isAttached :: Lens.Lens' StaticIp (Prelude.Maybe Prelude.Bool)
staticIp_isAttached :: Lens' StaticIp (Maybe Bool)
staticIp_isAttached = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StaticIp' {Maybe Bool
isAttached :: Maybe Bool
$sel:isAttached:StaticIp' :: StaticIp -> Maybe Bool
isAttached} -> Maybe Bool
isAttached) (\s :: StaticIp
s@StaticIp' {} Maybe Bool
a -> StaticIp
s {$sel:isAttached:StaticIp' :: Maybe Bool
isAttached = Maybe Bool
a} :: StaticIp)

-- | The region and Availability Zone where the static IP was created.
staticIp_location :: Lens.Lens' StaticIp (Prelude.Maybe ResourceLocation)
staticIp_location :: Lens' StaticIp (Maybe ResourceLocation)
staticIp_location = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StaticIp' {Maybe ResourceLocation
location :: Maybe ResourceLocation
$sel:location:StaticIp' :: StaticIp -> Maybe ResourceLocation
location} -> Maybe ResourceLocation
location) (\s :: StaticIp
s@StaticIp' {} Maybe ResourceLocation
a -> StaticIp
s {$sel:location:StaticIp' :: Maybe ResourceLocation
location = Maybe ResourceLocation
a} :: StaticIp)

-- | The name of the static IP (e.g., @StaticIP-Ohio-EXAMPLE@).
staticIp_name :: Lens.Lens' StaticIp (Prelude.Maybe Prelude.Text)
staticIp_name :: Lens' StaticIp (Maybe Text)
staticIp_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StaticIp' {Maybe Text
name :: Maybe Text
$sel:name:StaticIp' :: StaticIp -> Maybe Text
name} -> Maybe Text
name) (\s :: StaticIp
s@StaticIp' {} Maybe Text
a -> StaticIp
s {$sel:name:StaticIp' :: Maybe Text
name = Maybe Text
a} :: StaticIp)

-- | The resource type (usually @StaticIp@).
staticIp_resourceType :: Lens.Lens' StaticIp (Prelude.Maybe ResourceType)
staticIp_resourceType :: Lens' StaticIp (Maybe ResourceType)
staticIp_resourceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StaticIp' {Maybe ResourceType
resourceType :: Maybe ResourceType
$sel:resourceType:StaticIp' :: StaticIp -> Maybe ResourceType
resourceType} -> Maybe ResourceType
resourceType) (\s :: StaticIp
s@StaticIp' {} Maybe ResourceType
a -> StaticIp
s {$sel:resourceType:StaticIp' :: Maybe ResourceType
resourceType = Maybe ResourceType
a} :: StaticIp)

-- | The support code. Include this code in your email to support when you
-- have questions about an instance or another resource in Lightsail. This
-- code enables our support team to look up your Lightsail information more
-- easily.
staticIp_supportCode :: Lens.Lens' StaticIp (Prelude.Maybe Prelude.Text)
staticIp_supportCode :: Lens' StaticIp (Maybe Text)
staticIp_supportCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StaticIp' {Maybe Text
supportCode :: Maybe Text
$sel:supportCode:StaticIp' :: StaticIp -> Maybe Text
supportCode} -> Maybe Text
supportCode) (\s :: StaticIp
s@StaticIp' {} Maybe Text
a -> StaticIp
s {$sel:supportCode:StaticIp' :: Maybe Text
supportCode = Maybe Text
a} :: StaticIp)

instance Data.FromJSON StaticIp where
  parseJSON :: Value -> Parser StaticIp
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"StaticIp"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Bool
-> Maybe ResourceLocation
-> Maybe Text
-> Maybe ResourceType
-> Maybe Text
-> StaticIp
StaticIp'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"arn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"attachedTo")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"createdAt")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ipAddress")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"isAttached")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"location")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"name")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"resourceType")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"supportCode")
      )

instance Prelude.Hashable StaticIp where
  hashWithSalt :: Int -> StaticIp -> Int
hashWithSalt Int
_salt StaticIp' {Maybe Bool
Maybe Text
Maybe POSIX
Maybe ResourceLocation
Maybe ResourceType
supportCode :: Maybe Text
resourceType :: Maybe ResourceType
name :: Maybe Text
location :: Maybe ResourceLocation
isAttached :: Maybe Bool
ipAddress :: Maybe Text
createdAt :: Maybe POSIX
attachedTo :: Maybe Text
arn :: Maybe Text
$sel:supportCode:StaticIp' :: StaticIp -> Maybe Text
$sel:resourceType:StaticIp' :: StaticIp -> Maybe ResourceType
$sel:name:StaticIp' :: StaticIp -> Maybe Text
$sel:location:StaticIp' :: StaticIp -> Maybe ResourceLocation
$sel:isAttached:StaticIp' :: StaticIp -> Maybe Bool
$sel:ipAddress:StaticIp' :: StaticIp -> Maybe Text
$sel:createdAt:StaticIp' :: StaticIp -> Maybe POSIX
$sel:attachedTo:StaticIp' :: StaticIp -> Maybe Text
$sel:arn:StaticIp' :: StaticIp -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
arn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
attachedTo
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
createdAt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
ipAddress
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
isAttached
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ResourceLocation
location
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ResourceType
resourceType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
supportCode

instance Prelude.NFData StaticIp where
  rnf :: StaticIp -> ()
rnf StaticIp' {Maybe Bool
Maybe Text
Maybe POSIX
Maybe ResourceLocation
Maybe ResourceType
supportCode :: Maybe Text
resourceType :: Maybe ResourceType
name :: Maybe Text
location :: Maybe ResourceLocation
isAttached :: Maybe Bool
ipAddress :: Maybe Text
createdAt :: Maybe POSIX
attachedTo :: Maybe Text
arn :: Maybe Text
$sel:supportCode:StaticIp' :: StaticIp -> Maybe Text
$sel:resourceType:StaticIp' :: StaticIp -> Maybe ResourceType
$sel:name:StaticIp' :: StaticIp -> Maybe Text
$sel:location:StaticIp' :: StaticIp -> Maybe ResourceLocation
$sel:isAttached:StaticIp' :: StaticIp -> Maybe Bool
$sel:ipAddress:StaticIp' :: StaticIp -> Maybe Text
$sel:createdAt:StaticIp' :: StaticIp -> Maybe POSIX
$sel:attachedTo:StaticIp' :: StaticIp -> Maybe Text
$sel:arn:StaticIp' :: StaticIp -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
attachedTo
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
createdAt
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
ipAddress
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
isAttached
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ResourceLocation
location
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ResourceType
resourceType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
supportCode