{-# 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.Schemas.UpdateRegistry
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Updates a registry.
module Amazonka.Schemas.UpdateRegistry
  ( -- * Creating a Request
    UpdateRegistry (..),
    newUpdateRegistry,

    -- * Request Lenses
    updateRegistry_description,
    updateRegistry_registryName,

    -- * Destructuring the Response
    UpdateRegistryResponse (..),
    newUpdateRegistryResponse,

    -- * Response Lenses
    updateRegistryResponse_description,
    updateRegistryResponse_registryArn,
    updateRegistryResponse_registryName,
    updateRegistryResponse_tags,
    updateRegistryResponse_httpStatus,
  )
where

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

-- | Updates the registry.
--
-- /See:/ 'newUpdateRegistry' smart constructor.
data UpdateRegistry = UpdateRegistry'
  { -- | The description of the registry to update.
    UpdateRegistry -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The name of the registry.
    UpdateRegistry -> Text
registryName :: Prelude.Text
  }
  deriving (UpdateRegistry -> UpdateRegistry -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateRegistry -> UpdateRegistry -> Bool
$c/= :: UpdateRegistry -> UpdateRegistry -> Bool
== :: UpdateRegistry -> UpdateRegistry -> Bool
$c== :: UpdateRegistry -> UpdateRegistry -> Bool
Prelude.Eq, ReadPrec [UpdateRegistry]
ReadPrec UpdateRegistry
Int -> ReadS UpdateRegistry
ReadS [UpdateRegistry]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateRegistry]
$creadListPrec :: ReadPrec [UpdateRegistry]
readPrec :: ReadPrec UpdateRegistry
$creadPrec :: ReadPrec UpdateRegistry
readList :: ReadS [UpdateRegistry]
$creadList :: ReadS [UpdateRegistry]
readsPrec :: Int -> ReadS UpdateRegistry
$creadsPrec :: Int -> ReadS UpdateRegistry
Prelude.Read, Int -> UpdateRegistry -> ShowS
[UpdateRegistry] -> ShowS
UpdateRegistry -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateRegistry] -> ShowS
$cshowList :: [UpdateRegistry] -> ShowS
show :: UpdateRegistry -> String
$cshow :: UpdateRegistry -> String
showsPrec :: Int -> UpdateRegistry -> ShowS
$cshowsPrec :: Int -> UpdateRegistry -> ShowS
Prelude.Show, forall x. Rep UpdateRegistry x -> UpdateRegistry
forall x. UpdateRegistry -> Rep UpdateRegistry x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateRegistry x -> UpdateRegistry
$cfrom :: forall x. UpdateRegistry -> Rep UpdateRegistry x
Prelude.Generic)

-- |
-- Create a value of 'UpdateRegistry' 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:
--
-- 'description', 'updateRegistry_description' - The description of the registry to update.
--
-- 'registryName', 'updateRegistry_registryName' - The name of the registry.
newUpdateRegistry ::
  -- | 'registryName'
  Prelude.Text ->
  UpdateRegistry
newUpdateRegistry :: Text -> UpdateRegistry
newUpdateRegistry Text
pRegistryName_ =
  UpdateRegistry'
    { $sel:description:UpdateRegistry' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:registryName:UpdateRegistry' :: Text
registryName = Text
pRegistryName_
    }

-- | The description of the registry to update.
updateRegistry_description :: Lens.Lens' UpdateRegistry (Prelude.Maybe Prelude.Text)
updateRegistry_description :: Lens' UpdateRegistry (Maybe Text)
updateRegistry_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRegistry' {Maybe Text
description :: Maybe Text
$sel:description:UpdateRegistry' :: UpdateRegistry -> Maybe Text
description} -> Maybe Text
description) (\s :: UpdateRegistry
s@UpdateRegistry' {} Maybe Text
a -> UpdateRegistry
s {$sel:description:UpdateRegistry' :: Maybe Text
description = Maybe Text
a} :: UpdateRegistry)

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

instance Core.AWSRequest UpdateRegistry where
  type
    AWSResponse UpdateRegistry =
      UpdateRegistryResponse
  request :: (Service -> Service) -> UpdateRegistry -> Request UpdateRegistry
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy UpdateRegistry
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateRegistry)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Int
-> UpdateRegistryResponse
UpdateRegistryResponse'
            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
"Description")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"RegistryArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"RegistryName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"tags" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
            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 UpdateRegistry where
  hashWithSalt :: Int -> UpdateRegistry -> Int
hashWithSalt Int
_salt UpdateRegistry' {Maybe Text
Text
registryName :: Text
description :: Maybe Text
$sel:registryName:UpdateRegistry' :: UpdateRegistry -> Text
$sel:description:UpdateRegistry' :: UpdateRegistry -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
registryName

instance Prelude.NFData UpdateRegistry where
  rnf :: UpdateRegistry -> ()
rnf UpdateRegistry' {Maybe Text
Text
registryName :: Text
description :: Maybe Text
$sel:registryName:UpdateRegistry' :: UpdateRegistry -> Text
$sel:description:UpdateRegistry' :: UpdateRegistry -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
registryName

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

instance Data.ToJSON UpdateRegistry where
  toJSON :: UpdateRegistry -> Value
toJSON UpdateRegistry' {Maybe Text
Text
registryName :: Text
description :: Maybe Text
$sel:registryName:UpdateRegistry' :: UpdateRegistry -> Text
$sel:description:UpdateRegistry' :: UpdateRegistry -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Key
"Description" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
description]
      )

instance Data.ToPath UpdateRegistry where
  toPath :: UpdateRegistry -> ByteString
toPath UpdateRegistry' {Maybe Text
Text
registryName :: Text
description :: Maybe Text
$sel:registryName:UpdateRegistry' :: UpdateRegistry -> Text
$sel:description:UpdateRegistry' :: UpdateRegistry -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/v1/registries/name/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
registryName]

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

-- | /See:/ 'newUpdateRegistryResponse' smart constructor.
data UpdateRegistryResponse = UpdateRegistryResponse'
  { -- | The description of the registry.
    UpdateRegistryResponse -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the registry.
    UpdateRegistryResponse -> Maybe Text
registryArn :: Prelude.Maybe Prelude.Text,
    -- | The name of the registry.
    UpdateRegistryResponse -> Maybe Text
registryName :: Prelude.Maybe Prelude.Text,
    -- | Tags associated with the registry.
    UpdateRegistryResponse -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The response's http status code.
    UpdateRegistryResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (UpdateRegistryResponse -> UpdateRegistryResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateRegistryResponse -> UpdateRegistryResponse -> Bool
$c/= :: UpdateRegistryResponse -> UpdateRegistryResponse -> Bool
== :: UpdateRegistryResponse -> UpdateRegistryResponse -> Bool
$c== :: UpdateRegistryResponse -> UpdateRegistryResponse -> Bool
Prelude.Eq, ReadPrec [UpdateRegistryResponse]
ReadPrec UpdateRegistryResponse
Int -> ReadS UpdateRegistryResponse
ReadS [UpdateRegistryResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateRegistryResponse]
$creadListPrec :: ReadPrec [UpdateRegistryResponse]
readPrec :: ReadPrec UpdateRegistryResponse
$creadPrec :: ReadPrec UpdateRegistryResponse
readList :: ReadS [UpdateRegistryResponse]
$creadList :: ReadS [UpdateRegistryResponse]
readsPrec :: Int -> ReadS UpdateRegistryResponse
$creadsPrec :: Int -> ReadS UpdateRegistryResponse
Prelude.Read, Int -> UpdateRegistryResponse -> ShowS
[UpdateRegistryResponse] -> ShowS
UpdateRegistryResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateRegistryResponse] -> ShowS
$cshowList :: [UpdateRegistryResponse] -> ShowS
show :: UpdateRegistryResponse -> String
$cshow :: UpdateRegistryResponse -> String
showsPrec :: Int -> UpdateRegistryResponse -> ShowS
$cshowsPrec :: Int -> UpdateRegistryResponse -> ShowS
Prelude.Show, forall x. Rep UpdateRegistryResponse x -> UpdateRegistryResponse
forall x. UpdateRegistryResponse -> Rep UpdateRegistryResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateRegistryResponse x -> UpdateRegistryResponse
$cfrom :: forall x. UpdateRegistryResponse -> Rep UpdateRegistryResponse x
Prelude.Generic)

-- |
-- Create a value of 'UpdateRegistryResponse' 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:
--
-- 'description', 'updateRegistryResponse_description' - The description of the registry.
--
-- 'registryArn', 'updateRegistryResponse_registryArn' - The ARN of the registry.
--
-- 'registryName', 'updateRegistryResponse_registryName' - The name of the registry.
--
-- 'tags', 'updateRegistryResponse_tags' - Tags associated with the registry.
--
-- 'httpStatus', 'updateRegistryResponse_httpStatus' - The response's http status code.
newUpdateRegistryResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  UpdateRegistryResponse
newUpdateRegistryResponse :: Int -> UpdateRegistryResponse
newUpdateRegistryResponse Int
pHttpStatus_ =
  UpdateRegistryResponse'
    { $sel:description:UpdateRegistryResponse' :: Maybe Text
description =
        forall a. Maybe a
Prelude.Nothing,
      $sel:registryArn:UpdateRegistryResponse' :: Maybe Text
registryArn = forall a. Maybe a
Prelude.Nothing,
      $sel:registryName:UpdateRegistryResponse' :: Maybe Text
registryName = forall a. Maybe a
Prelude.Nothing,
      $sel:tags:UpdateRegistryResponse' :: Maybe (HashMap Text Text)
tags = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:UpdateRegistryResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The description of the registry.
updateRegistryResponse_description :: Lens.Lens' UpdateRegistryResponse (Prelude.Maybe Prelude.Text)
updateRegistryResponse_description :: Lens' UpdateRegistryResponse (Maybe Text)
updateRegistryResponse_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRegistryResponse' {Maybe Text
description :: Maybe Text
$sel:description:UpdateRegistryResponse' :: UpdateRegistryResponse -> Maybe Text
description} -> Maybe Text
description) (\s :: UpdateRegistryResponse
s@UpdateRegistryResponse' {} Maybe Text
a -> UpdateRegistryResponse
s {$sel:description:UpdateRegistryResponse' :: Maybe Text
description = Maybe Text
a} :: UpdateRegistryResponse)

-- | The ARN of the registry.
updateRegistryResponse_registryArn :: Lens.Lens' UpdateRegistryResponse (Prelude.Maybe Prelude.Text)
updateRegistryResponse_registryArn :: Lens' UpdateRegistryResponse (Maybe Text)
updateRegistryResponse_registryArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRegistryResponse' {Maybe Text
registryArn :: Maybe Text
$sel:registryArn:UpdateRegistryResponse' :: UpdateRegistryResponse -> Maybe Text
registryArn} -> Maybe Text
registryArn) (\s :: UpdateRegistryResponse
s@UpdateRegistryResponse' {} Maybe Text
a -> UpdateRegistryResponse
s {$sel:registryArn:UpdateRegistryResponse' :: Maybe Text
registryArn = Maybe Text
a} :: UpdateRegistryResponse)

-- | The name of the registry.
updateRegistryResponse_registryName :: Lens.Lens' UpdateRegistryResponse (Prelude.Maybe Prelude.Text)
updateRegistryResponse_registryName :: Lens' UpdateRegistryResponse (Maybe Text)
updateRegistryResponse_registryName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRegistryResponse' {Maybe Text
registryName :: Maybe Text
$sel:registryName:UpdateRegistryResponse' :: UpdateRegistryResponse -> Maybe Text
registryName} -> Maybe Text
registryName) (\s :: UpdateRegistryResponse
s@UpdateRegistryResponse' {} Maybe Text
a -> UpdateRegistryResponse
s {$sel:registryName:UpdateRegistryResponse' :: Maybe Text
registryName = Maybe Text
a} :: UpdateRegistryResponse)

-- | Tags associated with the registry.
updateRegistryResponse_tags :: Lens.Lens' UpdateRegistryResponse (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
updateRegistryResponse_tags :: Lens' UpdateRegistryResponse (Maybe (HashMap Text Text))
updateRegistryResponse_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRegistryResponse' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:UpdateRegistryResponse' :: UpdateRegistryResponse -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: UpdateRegistryResponse
s@UpdateRegistryResponse' {} Maybe (HashMap Text Text)
a -> UpdateRegistryResponse
s {$sel:tags:UpdateRegistryResponse' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: UpdateRegistryResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData UpdateRegistryResponse where
  rnf :: UpdateRegistryResponse -> ()
rnf UpdateRegistryResponse' {Int
Maybe Text
Maybe (HashMap Text Text)
httpStatus :: Int
tags :: Maybe (HashMap Text Text)
registryName :: Maybe Text
registryArn :: Maybe Text
description :: Maybe Text
$sel:httpStatus:UpdateRegistryResponse' :: UpdateRegistryResponse -> Int
$sel:tags:UpdateRegistryResponse' :: UpdateRegistryResponse -> Maybe (HashMap Text Text)
$sel:registryName:UpdateRegistryResponse' :: UpdateRegistryResponse -> Maybe Text
$sel:registryArn:UpdateRegistryResponse' :: UpdateRegistryResponse -> Maybe Text
$sel:description:UpdateRegistryResponse' :: UpdateRegistryResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
registryArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
registryName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
tags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus