{-# 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 #-}
module Amazonka.ECR.DeleteRepository
(
DeleteRepository (..),
newDeleteRepository,
deleteRepository_force,
deleteRepository_registryId,
deleteRepository_repositoryName,
DeleteRepositoryResponse (..),
newDeleteRepositoryResponse,
deleteRepositoryResponse_repository,
deleteRepositoryResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.ECR.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
data DeleteRepository = DeleteRepository'
{
DeleteRepository -> Maybe Bool
force :: Prelude.Maybe Prelude.Bool,
DeleteRepository -> Maybe Text
registryId :: Prelude.Maybe Prelude.Text,
DeleteRepository -> Text
repositoryName :: Prelude.Text
}
deriving (DeleteRepository -> DeleteRepository -> Bool
(DeleteRepository -> DeleteRepository -> Bool)
-> (DeleteRepository -> DeleteRepository -> Bool)
-> Eq DeleteRepository
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteRepository -> DeleteRepository -> Bool
$c/= :: DeleteRepository -> DeleteRepository -> Bool
== :: DeleteRepository -> DeleteRepository -> Bool
$c== :: DeleteRepository -> DeleteRepository -> Bool
Prelude.Eq, ReadPrec [DeleteRepository]
ReadPrec DeleteRepository
Int -> ReadS DeleteRepository
ReadS [DeleteRepository]
(Int -> ReadS DeleteRepository)
-> ReadS [DeleteRepository]
-> ReadPrec DeleteRepository
-> ReadPrec [DeleteRepository]
-> Read DeleteRepository
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteRepository]
$creadListPrec :: ReadPrec [DeleteRepository]
readPrec :: ReadPrec DeleteRepository
$creadPrec :: ReadPrec DeleteRepository
readList :: ReadS [DeleteRepository]
$creadList :: ReadS [DeleteRepository]
readsPrec :: Int -> ReadS DeleteRepository
$creadsPrec :: Int -> ReadS DeleteRepository
Prelude.Read, Int -> DeleteRepository -> ShowS
[DeleteRepository] -> ShowS
DeleteRepository -> String
(Int -> DeleteRepository -> ShowS)
-> (DeleteRepository -> String)
-> ([DeleteRepository] -> ShowS)
-> Show DeleteRepository
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteRepository] -> ShowS
$cshowList :: [DeleteRepository] -> ShowS
show :: DeleteRepository -> String
$cshow :: DeleteRepository -> String
showsPrec :: Int -> DeleteRepository -> ShowS
$cshowsPrec :: Int -> DeleteRepository -> ShowS
Prelude.Show, (forall x. DeleteRepository -> Rep DeleteRepository x)
-> (forall x. Rep DeleteRepository x -> DeleteRepository)
-> Generic DeleteRepository
forall x. Rep DeleteRepository x -> DeleteRepository
forall x. DeleteRepository -> Rep DeleteRepository x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteRepository x -> DeleteRepository
$cfrom :: forall x. DeleteRepository -> Rep DeleteRepository x
Prelude.Generic)
newDeleteRepository ::
Prelude.Text ->
DeleteRepository
newDeleteRepository :: Text -> DeleteRepository
newDeleteRepository Text
pRepositoryName_ =
DeleteRepository' :: Maybe Bool -> Maybe Text -> Text -> DeleteRepository
DeleteRepository'
{ $sel:force:DeleteRepository' :: Maybe Bool
force = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:registryId:DeleteRepository' :: Maybe Text
registryId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:repositoryName:DeleteRepository' :: Text
repositoryName = Text
pRepositoryName_
}
deleteRepository_force :: Lens.Lens' DeleteRepository (Prelude.Maybe Prelude.Bool)
deleteRepository_force :: (Maybe Bool -> f (Maybe Bool))
-> DeleteRepository -> f DeleteRepository
deleteRepository_force = (DeleteRepository -> Maybe Bool)
-> (DeleteRepository -> Maybe Bool -> DeleteRepository)
-> Lens DeleteRepository DeleteRepository (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteRepository' {Maybe Bool
force :: Maybe Bool
$sel:force:DeleteRepository' :: DeleteRepository -> Maybe Bool
force} -> Maybe Bool
force) (\s :: DeleteRepository
s@DeleteRepository' {} Maybe Bool
a -> DeleteRepository
s {$sel:force:DeleteRepository' :: Maybe Bool
force = Maybe Bool
a} :: DeleteRepository)
deleteRepository_registryId :: Lens.Lens' DeleteRepository (Prelude.Maybe Prelude.Text)
deleteRepository_registryId :: (Maybe Text -> f (Maybe Text))
-> DeleteRepository -> f DeleteRepository
deleteRepository_registryId = (DeleteRepository -> Maybe Text)
-> (DeleteRepository -> Maybe Text -> DeleteRepository)
-> Lens DeleteRepository DeleteRepository (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteRepository' {Maybe Text
registryId :: Maybe Text
$sel:registryId:DeleteRepository' :: DeleteRepository -> Maybe Text
registryId} -> Maybe Text
registryId) (\s :: DeleteRepository
s@DeleteRepository' {} Maybe Text
a -> DeleteRepository
s {$sel:registryId:DeleteRepository' :: Maybe Text
registryId = Maybe Text
a} :: DeleteRepository)
deleteRepository_repositoryName :: Lens.Lens' DeleteRepository Prelude.Text
deleteRepository_repositoryName :: (Text -> f Text) -> DeleteRepository -> f DeleteRepository
deleteRepository_repositoryName = (DeleteRepository -> Text)
-> (DeleteRepository -> Text -> DeleteRepository)
-> Lens DeleteRepository DeleteRepository Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteRepository' {Text
repositoryName :: Text
$sel:repositoryName:DeleteRepository' :: DeleteRepository -> Text
repositoryName} -> Text
repositoryName) (\s :: DeleteRepository
s@DeleteRepository' {} Text
a -> DeleteRepository
s {$sel:repositoryName:DeleteRepository' :: Text
repositoryName = Text
a} :: DeleteRepository)
instance Core.AWSRequest DeleteRepository where
type
AWSResponse DeleteRepository =
DeleteRepositoryResponse
request :: DeleteRepository -> Request DeleteRepository
request = Service -> DeleteRepository -> Request DeleteRepository
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DeleteRepository
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteRepository)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DeleteRepository))
-> Logger
-> Service
-> Proxy DeleteRepository
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteRepository)))
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 Repository -> Int -> DeleteRepositoryResponse
DeleteRepositoryResponse'
(Maybe Repository -> Int -> DeleteRepositoryResponse)
-> Either String (Maybe Repository)
-> Either String (Int -> DeleteRepositoryResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Repository)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"repository")
Either String (Int -> DeleteRepositoryResponse)
-> Either String Int -> Either String DeleteRepositoryResponse
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 DeleteRepository
instance Prelude.NFData DeleteRepository
instance Core.ToHeaders DeleteRepository where
toHeaders :: DeleteRepository -> ResponseHeaders
toHeaders =
ResponseHeaders -> DeleteRepository -> 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
"AmazonEC2ContainerRegistry_V20150921.DeleteRepository" ::
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 DeleteRepository where
toJSON :: DeleteRepository -> Value
toJSON DeleteRepository' {Maybe Bool
Maybe Text
Text
repositoryName :: Text
registryId :: Maybe Text
force :: Maybe Bool
$sel:repositoryName:DeleteRepository' :: DeleteRepository -> Text
$sel:registryId:DeleteRepository' :: DeleteRepository -> Maybe Text
$sel:force:DeleteRepository' :: DeleteRepository -> Maybe Bool
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"force" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
force,
(Text
"registryId" 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
registryId,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"repositoryName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
repositoryName)
]
)
instance Core.ToPath DeleteRepository where
toPath :: DeleteRepository -> ByteString
toPath = ByteString -> DeleteRepository -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DeleteRepository where
toQuery :: DeleteRepository -> QueryString
toQuery = QueryString -> DeleteRepository -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DeleteRepositoryResponse = DeleteRepositoryResponse'
{
DeleteRepositoryResponse -> Maybe Repository
repository :: Prelude.Maybe Repository,
DeleteRepositoryResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DeleteRepositoryResponse -> DeleteRepositoryResponse -> Bool
(DeleteRepositoryResponse -> DeleteRepositoryResponse -> Bool)
-> (DeleteRepositoryResponse -> DeleteRepositoryResponse -> Bool)
-> Eq DeleteRepositoryResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteRepositoryResponse -> DeleteRepositoryResponse -> Bool
$c/= :: DeleteRepositoryResponse -> DeleteRepositoryResponse -> Bool
== :: DeleteRepositoryResponse -> DeleteRepositoryResponse -> Bool
$c== :: DeleteRepositoryResponse -> DeleteRepositoryResponse -> Bool
Prelude.Eq, ReadPrec [DeleteRepositoryResponse]
ReadPrec DeleteRepositoryResponse
Int -> ReadS DeleteRepositoryResponse
ReadS [DeleteRepositoryResponse]
(Int -> ReadS DeleteRepositoryResponse)
-> ReadS [DeleteRepositoryResponse]
-> ReadPrec DeleteRepositoryResponse
-> ReadPrec [DeleteRepositoryResponse]
-> Read DeleteRepositoryResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteRepositoryResponse]
$creadListPrec :: ReadPrec [DeleteRepositoryResponse]
readPrec :: ReadPrec DeleteRepositoryResponse
$creadPrec :: ReadPrec DeleteRepositoryResponse
readList :: ReadS [DeleteRepositoryResponse]
$creadList :: ReadS [DeleteRepositoryResponse]
readsPrec :: Int -> ReadS DeleteRepositoryResponse
$creadsPrec :: Int -> ReadS DeleteRepositoryResponse
Prelude.Read, Int -> DeleteRepositoryResponse -> ShowS
[DeleteRepositoryResponse] -> ShowS
DeleteRepositoryResponse -> String
(Int -> DeleteRepositoryResponse -> ShowS)
-> (DeleteRepositoryResponse -> String)
-> ([DeleteRepositoryResponse] -> ShowS)
-> Show DeleteRepositoryResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteRepositoryResponse] -> ShowS
$cshowList :: [DeleteRepositoryResponse] -> ShowS
show :: DeleteRepositoryResponse -> String
$cshow :: DeleteRepositoryResponse -> String
showsPrec :: Int -> DeleteRepositoryResponse -> ShowS
$cshowsPrec :: Int -> DeleteRepositoryResponse -> ShowS
Prelude.Show, (forall x.
DeleteRepositoryResponse -> Rep DeleteRepositoryResponse x)
-> (forall x.
Rep DeleteRepositoryResponse x -> DeleteRepositoryResponse)
-> Generic DeleteRepositoryResponse
forall x.
Rep DeleteRepositoryResponse x -> DeleteRepositoryResponse
forall x.
DeleteRepositoryResponse -> Rep DeleteRepositoryResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteRepositoryResponse x -> DeleteRepositoryResponse
$cfrom :: forall x.
DeleteRepositoryResponse -> Rep DeleteRepositoryResponse x
Prelude.Generic)
newDeleteRepositoryResponse ::
Prelude.Int ->
DeleteRepositoryResponse
newDeleteRepositoryResponse :: Int -> DeleteRepositoryResponse
newDeleteRepositoryResponse Int
pHttpStatus_ =
DeleteRepositoryResponse' :: Maybe Repository -> Int -> DeleteRepositoryResponse
DeleteRepositoryResponse'
{ $sel:repository:DeleteRepositoryResponse' :: Maybe Repository
repository =
Maybe Repository
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DeleteRepositoryResponse' :: Int
httpStatus = Int
pHttpStatus_
}
deleteRepositoryResponse_repository :: Lens.Lens' DeleteRepositoryResponse (Prelude.Maybe Repository)
deleteRepositoryResponse_repository :: (Maybe Repository -> f (Maybe Repository))
-> DeleteRepositoryResponse -> f DeleteRepositoryResponse
deleteRepositoryResponse_repository = (DeleteRepositoryResponse -> Maybe Repository)
-> (DeleteRepositoryResponse
-> Maybe Repository -> DeleteRepositoryResponse)
-> Lens
DeleteRepositoryResponse
DeleteRepositoryResponse
(Maybe Repository)
(Maybe Repository)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteRepositoryResponse' {Maybe Repository
repository :: Maybe Repository
$sel:repository:DeleteRepositoryResponse' :: DeleteRepositoryResponse -> Maybe Repository
repository} -> Maybe Repository
repository) (\s :: DeleteRepositoryResponse
s@DeleteRepositoryResponse' {} Maybe Repository
a -> DeleteRepositoryResponse
s {$sel:repository:DeleteRepositoryResponse' :: Maybe Repository
repository = Maybe Repository
a} :: DeleteRepositoryResponse)
deleteRepositoryResponse_httpStatus :: Lens.Lens' DeleteRepositoryResponse Prelude.Int
deleteRepositoryResponse_httpStatus :: (Int -> f Int)
-> DeleteRepositoryResponse -> f DeleteRepositoryResponse
deleteRepositoryResponse_httpStatus = (DeleteRepositoryResponse -> Int)
-> (DeleteRepositoryResponse -> Int -> DeleteRepositoryResponse)
-> Lens DeleteRepositoryResponse DeleteRepositoryResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteRepositoryResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteRepositoryResponse' :: DeleteRepositoryResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeleteRepositoryResponse
s@DeleteRepositoryResponse' {} Int
a -> DeleteRepositoryResponse
s {$sel:httpStatus:DeleteRepositoryResponse' :: Int
httpStatus = Int
a} :: DeleteRepositoryResponse)
instance Prelude.NFData DeleteRepositoryResponse