{-# 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_description,
updateRepository_domainOwner,
updateRepository_upstreams,
updateRepository_domain,
updateRepository_repository,
UpdateRepositoryResponse (..),
newUpdateRepositoryResponse,
updateRepositoryResponse_repository,
updateRepositoryResponse_httpStatus,
)
where
import Amazonka.CodeArtifact.Types
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
data UpdateRepository = UpdateRepository'
{
UpdateRepository -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
UpdateRepository -> Maybe Text
domainOwner :: Prelude.Maybe Prelude.Text,
UpdateRepository -> Maybe [UpstreamRepository]
upstreams :: Prelude.Maybe [UpstreamRepository],
UpdateRepository -> Text
domain :: Prelude.Text,
UpdateRepository -> Text
repository :: Prelude.Text
}
deriving (UpdateRepository -> UpdateRepository -> Bool
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]
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
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. 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'
{ $sel:description:UpdateRepository' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
$sel:domainOwner:UpdateRepository' :: Maybe Text
domainOwner = forall a. Maybe a
Prelude.Nothing,
$sel:upstreams:UpdateRepository' :: Maybe [UpstreamRepository]
upstreams = forall a. Maybe a
Prelude.Nothing,
$sel:domain:UpdateRepository' :: Text
domain = Text
pDomain_,
$sel:repository:UpdateRepository' :: Text
repository = Text
pRepository_
}
updateRepository_description :: Lens.Lens' UpdateRepository (Prelude.Maybe Prelude.Text)
updateRepository_description :: Lens' UpdateRepository (Maybe Text)
updateRepository_description = 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_domainOwner :: Lens.Lens' UpdateRepository (Prelude.Maybe Prelude.Text)
updateRepository_domainOwner :: Lens' UpdateRepository (Maybe Text)
updateRepository_domainOwner = 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_upstreams :: Lens.Lens' UpdateRepository (Prelude.Maybe [UpstreamRepository])
updateRepository_upstreams :: Lens' UpdateRepository (Maybe [UpstreamRepository])
updateRepository_upstreams = 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) 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
updateRepository_domain :: Lens.Lens' UpdateRepository Prelude.Text
updateRepository_domain :: Lens' UpdateRepository Text
updateRepository_domain = 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 :: Lens' UpdateRepository Text
updateRepository_repository = 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 :: (Service -> Service)
-> UpdateRepository -> Request UpdateRepository
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 UpdateRepository
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateRepository)))
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 RepositoryDescription -> Int -> UpdateRepositoryResponse
UpdateRepositoryResponse'
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
"repository")
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 UpdateRepository where
hashWithSalt :: Int -> UpdateRepository -> Int
hashWithSalt Int
_salt UpdateRepository' {Maybe [UpstreamRepository]
Maybe Text
Text
repository :: Text
domain :: Text
upstreams :: Maybe [UpstreamRepository]
domainOwner :: Maybe Text
description :: Maybe Text
$sel:repository:UpdateRepository' :: UpdateRepository -> Text
$sel:domain:UpdateRepository' :: UpdateRepository -> Text
$sel:upstreams:UpdateRepository' :: UpdateRepository -> Maybe [UpstreamRepository]
$sel:domainOwner:UpdateRepository' :: UpdateRepository -> Maybe Text
$sel:description:UpdateRepository' :: UpdateRepository -> 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` Maybe Text
domainOwner
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [UpstreamRepository]
upstreams
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
domain
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
repository
instance Prelude.NFData UpdateRepository where
rnf :: UpdateRepository -> ()
rnf UpdateRepository' {Maybe [UpstreamRepository]
Maybe Text
Text
repository :: Text
domain :: Text
upstreams :: Maybe [UpstreamRepository]
domainOwner :: Maybe Text
description :: Maybe Text
$sel:repository:UpdateRepository' :: UpdateRepository -> Text
$sel:domain:UpdateRepository' :: UpdateRepository -> Text
$sel:upstreams:UpdateRepository' :: UpdateRepository -> Maybe [UpstreamRepository]
$sel:domainOwner:UpdateRepository' :: UpdateRepository -> Maybe Text
$sel:description:UpdateRepository' :: UpdateRepository -> 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
domainOwner
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [UpstreamRepository]
upstreams
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
domain
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
repository
instance Data.ToHeaders UpdateRepository where
toHeaders :: UpdateRepository -> 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 UpdateRepository where
toJSON :: UpdateRepository -> Value
toJSON UpdateRepository' {Maybe [UpstreamRepository]
Maybe Text
Text
repository :: Text
domain :: Text
upstreams :: Maybe [UpstreamRepository]
domainOwner :: Maybe Text
description :: Maybe Text
$sel:repository:UpdateRepository' :: UpdateRepository -> Text
$sel:domain:UpdateRepository' :: UpdateRepository -> Text
$sel:upstreams:UpdateRepository' :: UpdateRepository -> Maybe [UpstreamRepository]
$sel:domainOwner:UpdateRepository' :: UpdateRepository -> Maybe Text
$sel:description:UpdateRepository' :: UpdateRepository -> 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,
(Key
"upstreams" 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 [UpstreamRepository]
upstreams
]
)
instance Data.ToPath UpdateRepository where
toPath :: UpdateRepository -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/v1/repository"
instance Data.ToQuery UpdateRepository where
toQuery :: UpdateRepository -> QueryString
toQuery UpdateRepository' {Maybe [UpstreamRepository]
Maybe Text
Text
repository :: Text
domain :: Text
upstreams :: Maybe [UpstreamRepository]
domainOwner :: Maybe Text
description :: Maybe Text
$sel:repository:UpdateRepository' :: UpdateRepository -> Text
$sel:domain:UpdateRepository' :: UpdateRepository -> Text
$sel:upstreams:UpdateRepository' :: UpdateRepository -> Maybe [UpstreamRepository]
$sel:domainOwner:UpdateRepository' :: UpdateRepository -> Maybe Text
$sel:description:UpdateRepository' :: UpdateRepository -> Maybe Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"domain-owner" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
domainOwner,
ByteString
"domain" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
domain,
ByteString
"repository" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
repository
]
data UpdateRepositoryResponse = UpdateRepositoryResponse'
{
UpdateRepositoryResponse -> Maybe RepositoryDescription
repository :: Prelude.Maybe RepositoryDescription,
UpdateRepositoryResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateRepositoryResponse -> UpdateRepositoryResponse -> Bool
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]
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
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.
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'
{ $sel:repository:UpdateRepositoryResponse' :: Maybe RepositoryDescription
repository =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateRepositoryResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateRepositoryResponse_repository :: Lens.Lens' UpdateRepositoryResponse (Prelude.Maybe RepositoryDescription)
updateRepositoryResponse_repository :: Lens' UpdateRepositoryResponse (Maybe RepositoryDescription)
updateRepositoryResponse_repository = 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 :: Lens' UpdateRepositoryResponse Int
updateRepositoryResponse_httpStatus = 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 where
rnf :: UpdateRepositoryResponse -> ()
rnf UpdateRepositoryResponse' {Int
Maybe RepositoryDescription
httpStatus :: Int
repository :: Maybe RepositoryDescription
$sel:httpStatus:UpdateRepositoryResponse' :: UpdateRepositoryResponse -> Int
$sel:repository:UpdateRepositoryResponse' :: UpdateRepositoryResponse -> Maybe RepositoryDescription
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe RepositoryDescription
repository
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus