{-# 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.CodeArtifact.UpdateRepository
(
UpdateRepository (..),
newUpdateRepository,
updateRepository_upstreams,
updateRepository_domainOwner,
updateRepository_description,
updateRepository_domain,
updateRepository_repository,
UpdateRepositoryResponse (..),
newUpdateRepositoryResponse,
updateRepositoryResponse_repository,
updateRepositoryResponse_httpStatus,
)
where
import Amazonka.CodeArtifact.Types
import qualified Amazonka.Core as Core
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 UpdateRepository = UpdateRepository'
{
UpdateRepository -> Maybe [UpstreamRepository]
upstreams :: Prelude.Maybe [UpstreamRepository],
UpdateRepository -> Maybe Text
domainOwner :: Prelude.Maybe Prelude.Text,
UpdateRepository -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
UpdateRepository -> Text
domain :: Prelude.Text,
UpdateRepository -> Text
repository :: Prelude.Text
}
deriving (UpdateRepository -> UpdateRepository -> Bool
(UpdateRepository -> UpdateRepository -> Bool)
-> (UpdateRepository -> UpdateRepository -> Bool)
-> Eq UpdateRepository
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateRepository -> UpdateRepository -> Bool
$c/= :: UpdateRepository -> UpdateRepository -> Bool
== :: UpdateRepository -> UpdateRepository -> Bool
$c== :: UpdateRepository -> UpdateRepository -> Bool
Prelude.Eq, ReadPrec [UpdateRepository]
ReadPrec UpdateRepository
Int -> ReadS UpdateRepository
ReadS [UpdateRepository]
(Int -> ReadS UpdateRepository)
-> ReadS [UpdateRepository]
-> ReadPrec UpdateRepository
-> ReadPrec [UpdateRepository]
-> Read UpdateRepository
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateRepository]
$creadListPrec :: ReadPrec [UpdateRepository]
readPrec :: ReadPrec UpdateRepository
$creadPrec :: ReadPrec UpdateRepository
readList :: ReadS [UpdateRepository]
$creadList :: ReadS [UpdateRepository]
readsPrec :: Int -> ReadS UpdateRepository
$creadsPrec :: Int -> ReadS UpdateRepository
Prelude.Read, Int -> UpdateRepository -> ShowS
[UpdateRepository] -> ShowS
UpdateRepository -> String
(Int -> UpdateRepository -> ShowS)
-> (UpdateRepository -> String)
-> ([UpdateRepository] -> ShowS)
-> Show UpdateRepository
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateRepository] -> ShowS
$cshowList :: [UpdateRepository] -> ShowS
show :: UpdateRepository -> String
$cshow :: UpdateRepository -> String
showsPrec :: Int -> UpdateRepository -> ShowS
$cshowsPrec :: Int -> UpdateRepository -> ShowS
Prelude.Show, (forall x. UpdateRepository -> Rep UpdateRepository x)
-> (forall x. Rep UpdateRepository x -> UpdateRepository)
-> Generic UpdateRepository
forall x. Rep UpdateRepository x -> UpdateRepository
forall x. UpdateRepository -> Rep UpdateRepository x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateRepository x -> UpdateRepository
$cfrom :: forall x. UpdateRepository -> Rep UpdateRepository x
Prelude.Generic)
newUpdateRepository ::
Prelude.Text ->
Prelude.Text ->
UpdateRepository
newUpdateRepository :: Text -> Text -> UpdateRepository
newUpdateRepository Text
pDomain_ Text
pRepository_ =
UpdateRepository' :: Maybe [UpstreamRepository]
-> Maybe Text -> Maybe Text -> Text -> Text -> UpdateRepository
UpdateRepository'
{ $sel:upstreams:UpdateRepository' :: Maybe [UpstreamRepository]
upstreams = Maybe [UpstreamRepository]
forall a. Maybe a
Prelude.Nothing,
$sel:domainOwner:UpdateRepository' :: Maybe Text
domainOwner = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:description:UpdateRepository' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:domain:UpdateRepository' :: Text
domain = Text
pDomain_,
$sel:repository:UpdateRepository' :: Text
repository = Text
pRepository_
}
updateRepository_upstreams :: Lens.Lens' UpdateRepository (Prelude.Maybe [UpstreamRepository])
updateRepository_upstreams :: (Maybe [UpstreamRepository] -> f (Maybe [UpstreamRepository]))
-> UpdateRepository -> f UpdateRepository
updateRepository_upstreams = (UpdateRepository -> Maybe [UpstreamRepository])
-> (UpdateRepository
-> Maybe [UpstreamRepository] -> UpdateRepository)
-> Lens
UpdateRepository
UpdateRepository
(Maybe [UpstreamRepository])
(Maybe [UpstreamRepository])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRepository' {Maybe [UpstreamRepository]
upstreams :: Maybe [UpstreamRepository]
$sel:upstreams:UpdateRepository' :: UpdateRepository -> Maybe [UpstreamRepository]
upstreams} -> Maybe [UpstreamRepository]
upstreams) (\s :: UpdateRepository
s@UpdateRepository' {} Maybe [UpstreamRepository]
a -> UpdateRepository
s {$sel:upstreams:UpdateRepository' :: Maybe [UpstreamRepository]
upstreams = Maybe [UpstreamRepository]
a} :: UpdateRepository) ((Maybe [UpstreamRepository] -> f (Maybe [UpstreamRepository]))
-> UpdateRepository -> f UpdateRepository)
-> ((Maybe [UpstreamRepository] -> f (Maybe [UpstreamRepository]))
-> Maybe [UpstreamRepository] -> f (Maybe [UpstreamRepository]))
-> (Maybe [UpstreamRepository] -> f (Maybe [UpstreamRepository]))
-> UpdateRepository
-> f UpdateRepository
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[UpstreamRepository]
[UpstreamRepository]
[UpstreamRepository]
[UpstreamRepository]
-> Iso
(Maybe [UpstreamRepository])
(Maybe [UpstreamRepository])
(Maybe [UpstreamRepository])
(Maybe [UpstreamRepository])
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
[UpstreamRepository]
[UpstreamRepository]
[UpstreamRepository]
[UpstreamRepository]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
updateRepository_domainOwner :: Lens.Lens' UpdateRepository (Prelude.Maybe Prelude.Text)
updateRepository_domainOwner :: (Maybe Text -> f (Maybe Text))
-> UpdateRepository -> f UpdateRepository
updateRepository_domainOwner = (UpdateRepository -> Maybe Text)
-> (UpdateRepository -> Maybe Text -> UpdateRepository)
-> Lens UpdateRepository UpdateRepository (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRepository' {Maybe Text
domainOwner :: Maybe Text
$sel:domainOwner:UpdateRepository' :: UpdateRepository -> Maybe Text
domainOwner} -> Maybe Text
domainOwner) (\s :: UpdateRepository
s@UpdateRepository' {} Maybe Text
a -> UpdateRepository
s {$sel:domainOwner:UpdateRepository' :: Maybe Text
domainOwner = Maybe Text
a} :: UpdateRepository)
updateRepository_description :: Lens.Lens' UpdateRepository (Prelude.Maybe Prelude.Text)
updateRepository_description :: (Maybe Text -> f (Maybe Text))
-> UpdateRepository -> f UpdateRepository
updateRepository_description = (UpdateRepository -> Maybe Text)
-> (UpdateRepository -> Maybe Text -> UpdateRepository)
-> Lens UpdateRepository UpdateRepository (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRepository' {Maybe Text
description :: Maybe Text
$sel:description:UpdateRepository' :: UpdateRepository -> Maybe Text
description} -> Maybe Text
description) (\s :: UpdateRepository
s@UpdateRepository' {} Maybe Text
a -> UpdateRepository
s {$sel:description:UpdateRepository' :: Maybe Text
description = Maybe Text
a} :: UpdateRepository)
updateRepository_domain :: Lens.Lens' UpdateRepository Prelude.Text
updateRepository_domain :: (Text -> f Text) -> UpdateRepository -> f UpdateRepository
updateRepository_domain = (UpdateRepository -> Text)
-> (UpdateRepository -> Text -> UpdateRepository)
-> Lens UpdateRepository UpdateRepository Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRepository' {Text
domain :: Text
$sel:domain:UpdateRepository' :: UpdateRepository -> Text
domain} -> Text
domain) (\s :: UpdateRepository
s@UpdateRepository' {} Text
a -> UpdateRepository
s {$sel:domain:UpdateRepository' :: Text
domain = Text
a} :: UpdateRepository)
updateRepository_repository :: Lens.Lens' UpdateRepository Prelude.Text
updateRepository_repository :: (Text -> f Text) -> UpdateRepository -> f UpdateRepository
updateRepository_repository = (UpdateRepository -> Text)
-> (UpdateRepository -> Text -> UpdateRepository)
-> Lens UpdateRepository UpdateRepository Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRepository' {Text
repository :: Text
$sel:repository:UpdateRepository' :: UpdateRepository -> Text
repository} -> Text
repository) (\s :: UpdateRepository
s@UpdateRepository' {} Text
a -> UpdateRepository
s {$sel:repository:UpdateRepository' :: Text
repository = Text
a} :: UpdateRepository)
instance Core.AWSRequest UpdateRepository where
type
AWSResponse UpdateRepository =
UpdateRepositoryResponse
request :: UpdateRepository -> Request UpdateRepository
request = Service -> UpdateRepository -> Request UpdateRepository
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateRepository
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateRepository)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateRepository))
-> Logger
-> Service
-> Proxy UpdateRepository
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateRepository)))
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 RepositoryDescription -> Int -> UpdateRepositoryResponse
UpdateRepositoryResponse'
(Maybe RepositoryDescription -> Int -> UpdateRepositoryResponse)
-> Either String (Maybe RepositoryDescription)
-> Either String (Int -> UpdateRepositoryResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe RepositoryDescription)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"repository")
Either String (Int -> UpdateRepositoryResponse)
-> Either String Int -> Either String UpdateRepositoryResponse
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 UpdateRepository
instance Prelude.NFData UpdateRepository
instance Core.ToHeaders UpdateRepository where
toHeaders :: UpdateRepository -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateRepository -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ 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 UpdateRepository where
toJSON :: UpdateRepository -> Value
toJSON UpdateRepository' {Maybe [UpstreamRepository]
Maybe Text
Text
repository :: Text
domain :: Text
description :: Maybe Text
domainOwner :: Maybe Text
upstreams :: Maybe [UpstreamRepository]
$sel:repository:UpdateRepository' :: UpdateRepository -> Text
$sel:domain:UpdateRepository' :: UpdateRepository -> Text
$sel:description:UpdateRepository' :: UpdateRepository -> Maybe Text
$sel:domainOwner:UpdateRepository' :: UpdateRepository -> Maybe Text
$sel:upstreams:UpdateRepository' :: UpdateRepository -> Maybe [UpstreamRepository]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"upstreams" Text -> [UpstreamRepository] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([UpstreamRepository] -> Pair)
-> Maybe [UpstreamRepository] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [UpstreamRepository]
upstreams,
(Text
"description" 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
description
]
)
instance Core.ToPath UpdateRepository where
toPath :: UpdateRepository -> ByteString
toPath = ByteString -> UpdateRepository -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/v1/repository"
instance Core.ToQuery UpdateRepository where
toQuery :: UpdateRepository -> QueryString
toQuery UpdateRepository' {Maybe [UpstreamRepository]
Maybe Text
Text
repository :: Text
domain :: Text
description :: Maybe Text
domainOwner :: Maybe Text
upstreams :: Maybe [UpstreamRepository]
$sel:repository:UpdateRepository' :: UpdateRepository -> Text
$sel:domain:UpdateRepository' :: UpdateRepository -> Text
$sel:description:UpdateRepository' :: UpdateRepository -> Maybe Text
$sel:domainOwner:UpdateRepository' :: UpdateRepository -> Maybe Text
$sel:upstreams:UpdateRepository' :: UpdateRepository -> Maybe [UpstreamRepository]
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"domain-owner" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
domainOwner,
ByteString
"domain" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
domain,
ByteString
"repository" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
repository
]
data UpdateRepositoryResponse = UpdateRepositoryResponse'
{
UpdateRepositoryResponse -> Maybe RepositoryDescription
repository :: Prelude.Maybe RepositoryDescription,
UpdateRepositoryResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateRepositoryResponse -> UpdateRepositoryResponse -> Bool
(UpdateRepositoryResponse -> UpdateRepositoryResponse -> Bool)
-> (UpdateRepositoryResponse -> UpdateRepositoryResponse -> Bool)
-> Eq UpdateRepositoryResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateRepositoryResponse -> UpdateRepositoryResponse -> Bool
$c/= :: UpdateRepositoryResponse -> UpdateRepositoryResponse -> Bool
== :: UpdateRepositoryResponse -> UpdateRepositoryResponse -> Bool
$c== :: UpdateRepositoryResponse -> UpdateRepositoryResponse -> Bool
Prelude.Eq, ReadPrec [UpdateRepositoryResponse]
ReadPrec UpdateRepositoryResponse
Int -> ReadS UpdateRepositoryResponse
ReadS [UpdateRepositoryResponse]
(Int -> ReadS UpdateRepositoryResponse)
-> ReadS [UpdateRepositoryResponse]
-> ReadPrec UpdateRepositoryResponse
-> ReadPrec [UpdateRepositoryResponse]
-> Read UpdateRepositoryResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateRepositoryResponse]
$creadListPrec :: ReadPrec [UpdateRepositoryResponse]
readPrec :: ReadPrec UpdateRepositoryResponse
$creadPrec :: ReadPrec UpdateRepositoryResponse
readList :: ReadS [UpdateRepositoryResponse]
$creadList :: ReadS [UpdateRepositoryResponse]
readsPrec :: Int -> ReadS UpdateRepositoryResponse
$creadsPrec :: Int -> ReadS UpdateRepositoryResponse
Prelude.Read, Int -> UpdateRepositoryResponse -> ShowS
[UpdateRepositoryResponse] -> ShowS
UpdateRepositoryResponse -> String
(Int -> UpdateRepositoryResponse -> ShowS)
-> (UpdateRepositoryResponse -> String)
-> ([UpdateRepositoryResponse] -> ShowS)
-> Show UpdateRepositoryResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateRepositoryResponse] -> ShowS
$cshowList :: [UpdateRepositoryResponse] -> ShowS
show :: UpdateRepositoryResponse -> String
$cshow :: UpdateRepositoryResponse -> String
showsPrec :: Int -> UpdateRepositoryResponse -> ShowS
$cshowsPrec :: Int -> UpdateRepositoryResponse -> ShowS
Prelude.Show, (forall x.
UpdateRepositoryResponse -> Rep UpdateRepositoryResponse x)
-> (forall x.
Rep UpdateRepositoryResponse x -> UpdateRepositoryResponse)
-> Generic UpdateRepositoryResponse
forall x.
Rep UpdateRepositoryResponse x -> UpdateRepositoryResponse
forall x.
UpdateRepositoryResponse -> Rep UpdateRepositoryResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateRepositoryResponse x -> UpdateRepositoryResponse
$cfrom :: forall x.
UpdateRepositoryResponse -> Rep UpdateRepositoryResponse x
Prelude.Generic)
newUpdateRepositoryResponse ::
Prelude.Int ->
UpdateRepositoryResponse
newUpdateRepositoryResponse :: Int -> UpdateRepositoryResponse
newUpdateRepositoryResponse Int
pHttpStatus_ =
UpdateRepositoryResponse' :: Maybe RepositoryDescription -> Int -> UpdateRepositoryResponse
UpdateRepositoryResponse'
{ $sel:repository:UpdateRepositoryResponse' :: Maybe RepositoryDescription
repository =
Maybe RepositoryDescription
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateRepositoryResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateRepositoryResponse_repository :: Lens.Lens' UpdateRepositoryResponse (Prelude.Maybe RepositoryDescription)
updateRepositoryResponse_repository :: (Maybe RepositoryDescription -> f (Maybe RepositoryDescription))
-> UpdateRepositoryResponse -> f UpdateRepositoryResponse
updateRepositoryResponse_repository = (UpdateRepositoryResponse -> Maybe RepositoryDescription)
-> (UpdateRepositoryResponse
-> Maybe RepositoryDescription -> UpdateRepositoryResponse)
-> Lens
UpdateRepositoryResponse
UpdateRepositoryResponse
(Maybe RepositoryDescription)
(Maybe RepositoryDescription)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRepositoryResponse' {Maybe RepositoryDescription
repository :: Maybe RepositoryDescription
$sel:repository:UpdateRepositoryResponse' :: UpdateRepositoryResponse -> Maybe RepositoryDescription
repository} -> Maybe RepositoryDescription
repository) (\s :: UpdateRepositoryResponse
s@UpdateRepositoryResponse' {} Maybe RepositoryDescription
a -> UpdateRepositoryResponse
s {$sel:repository:UpdateRepositoryResponse' :: Maybe RepositoryDescription
repository = Maybe RepositoryDescription
a} :: UpdateRepositoryResponse)
updateRepositoryResponse_httpStatus :: Lens.Lens' UpdateRepositoryResponse Prelude.Int
updateRepositoryResponse_httpStatus :: (Int -> f Int)
-> UpdateRepositoryResponse -> f UpdateRepositoryResponse
updateRepositoryResponse_httpStatus = (UpdateRepositoryResponse -> Int)
-> (UpdateRepositoryResponse -> Int -> UpdateRepositoryResponse)
-> Lens UpdateRepositoryResponse UpdateRepositoryResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRepositoryResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateRepositoryResponse' :: UpdateRepositoryResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateRepositoryResponse
s@UpdateRepositoryResponse' {} Int
a -> UpdateRepositoryResponse
s {$sel:httpStatus:UpdateRepositoryResponse' :: Int
httpStatus = Int
a} :: UpdateRepositoryResponse)
instance Prelude.NFData UpdateRepositoryResponse