{-# 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.AssociateExternalConnection
(
AssociateExternalConnection (..),
newAssociateExternalConnection,
associateExternalConnection_domainOwner,
associateExternalConnection_domain,
associateExternalConnection_repository,
associateExternalConnection_externalConnection,
AssociateExternalConnectionResponse (..),
newAssociateExternalConnectionResponse,
associateExternalConnectionResponse_repository,
associateExternalConnectionResponse_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 AssociateExternalConnection = AssociateExternalConnection'
{
AssociateExternalConnection -> Maybe Text
domainOwner :: Prelude.Maybe Prelude.Text,
AssociateExternalConnection -> Text
domain :: Prelude.Text,
AssociateExternalConnection -> Text
repository :: Prelude.Text,
AssociateExternalConnection -> Text
externalConnection :: Prelude.Text
}
deriving (AssociateExternalConnection -> AssociateExternalConnection -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociateExternalConnection -> AssociateExternalConnection -> Bool
$c/= :: AssociateExternalConnection -> AssociateExternalConnection -> Bool
== :: AssociateExternalConnection -> AssociateExternalConnection -> Bool
$c== :: AssociateExternalConnection -> AssociateExternalConnection -> Bool
Prelude.Eq, ReadPrec [AssociateExternalConnection]
ReadPrec AssociateExternalConnection
Int -> ReadS AssociateExternalConnection
ReadS [AssociateExternalConnection]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssociateExternalConnection]
$creadListPrec :: ReadPrec [AssociateExternalConnection]
readPrec :: ReadPrec AssociateExternalConnection
$creadPrec :: ReadPrec AssociateExternalConnection
readList :: ReadS [AssociateExternalConnection]
$creadList :: ReadS [AssociateExternalConnection]
readsPrec :: Int -> ReadS AssociateExternalConnection
$creadsPrec :: Int -> ReadS AssociateExternalConnection
Prelude.Read, Int -> AssociateExternalConnection -> ShowS
[AssociateExternalConnection] -> ShowS
AssociateExternalConnection -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociateExternalConnection] -> ShowS
$cshowList :: [AssociateExternalConnection] -> ShowS
show :: AssociateExternalConnection -> String
$cshow :: AssociateExternalConnection -> String
showsPrec :: Int -> AssociateExternalConnection -> ShowS
$cshowsPrec :: Int -> AssociateExternalConnection -> ShowS
Prelude.Show, forall x.
Rep AssociateExternalConnection x -> AssociateExternalConnection
forall x.
AssociateExternalConnection -> Rep AssociateExternalConnection x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AssociateExternalConnection x -> AssociateExternalConnection
$cfrom :: forall x.
AssociateExternalConnection -> Rep AssociateExternalConnection x
Prelude.Generic)
newAssociateExternalConnection ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
AssociateExternalConnection
newAssociateExternalConnection :: Text -> Text -> Text -> AssociateExternalConnection
newAssociateExternalConnection
Text
pDomain_
Text
pRepository_
Text
pExternalConnection_ =
AssociateExternalConnection'
{ $sel:domainOwner:AssociateExternalConnection' :: Maybe Text
domainOwner =
forall a. Maybe a
Prelude.Nothing,
$sel:domain:AssociateExternalConnection' :: Text
domain = Text
pDomain_,
$sel:repository:AssociateExternalConnection' :: Text
repository = Text
pRepository_,
$sel:externalConnection:AssociateExternalConnection' :: Text
externalConnection = Text
pExternalConnection_
}
associateExternalConnection_domainOwner :: Lens.Lens' AssociateExternalConnection (Prelude.Maybe Prelude.Text)
associateExternalConnection_domainOwner :: Lens' AssociateExternalConnection (Maybe Text)
associateExternalConnection_domainOwner = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateExternalConnection' {Maybe Text
domainOwner :: Maybe Text
$sel:domainOwner:AssociateExternalConnection' :: AssociateExternalConnection -> Maybe Text
domainOwner} -> Maybe Text
domainOwner) (\s :: AssociateExternalConnection
s@AssociateExternalConnection' {} Maybe Text
a -> AssociateExternalConnection
s {$sel:domainOwner:AssociateExternalConnection' :: Maybe Text
domainOwner = Maybe Text
a} :: AssociateExternalConnection)
associateExternalConnection_domain :: Lens.Lens' AssociateExternalConnection Prelude.Text
associateExternalConnection_domain :: Lens' AssociateExternalConnection Text
associateExternalConnection_domain = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateExternalConnection' {Text
domain :: Text
$sel:domain:AssociateExternalConnection' :: AssociateExternalConnection -> Text
domain} -> Text
domain) (\s :: AssociateExternalConnection
s@AssociateExternalConnection' {} Text
a -> AssociateExternalConnection
s {$sel:domain:AssociateExternalConnection' :: Text
domain = Text
a} :: AssociateExternalConnection)
associateExternalConnection_repository :: Lens.Lens' AssociateExternalConnection Prelude.Text
associateExternalConnection_repository :: Lens' AssociateExternalConnection Text
associateExternalConnection_repository = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateExternalConnection' {Text
repository :: Text
$sel:repository:AssociateExternalConnection' :: AssociateExternalConnection -> Text
repository} -> Text
repository) (\s :: AssociateExternalConnection
s@AssociateExternalConnection' {} Text
a -> AssociateExternalConnection
s {$sel:repository:AssociateExternalConnection' :: Text
repository = Text
a} :: AssociateExternalConnection)
associateExternalConnection_externalConnection :: Lens.Lens' AssociateExternalConnection Prelude.Text
associateExternalConnection_externalConnection :: Lens' AssociateExternalConnection Text
associateExternalConnection_externalConnection = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateExternalConnection' {Text
externalConnection :: Text
$sel:externalConnection:AssociateExternalConnection' :: AssociateExternalConnection -> Text
externalConnection} -> Text
externalConnection) (\s :: AssociateExternalConnection
s@AssociateExternalConnection' {} Text
a -> AssociateExternalConnection
s {$sel:externalConnection:AssociateExternalConnection' :: Text
externalConnection = Text
a} :: AssociateExternalConnection)
instance Core.AWSRequest AssociateExternalConnection where
type
AWSResponse AssociateExternalConnection =
AssociateExternalConnectionResponse
request :: (Service -> Service)
-> AssociateExternalConnection
-> Request AssociateExternalConnection
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy AssociateExternalConnection
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AssociateExternalConnection)))
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 -> AssociateExternalConnectionResponse
AssociateExternalConnectionResponse'
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 AssociateExternalConnection where
hashWithSalt :: Int -> AssociateExternalConnection -> Int
hashWithSalt Int
_salt AssociateExternalConnection' {Maybe Text
Text
externalConnection :: Text
repository :: Text
domain :: Text
domainOwner :: Maybe Text
$sel:externalConnection:AssociateExternalConnection' :: AssociateExternalConnection -> Text
$sel:repository:AssociateExternalConnection' :: AssociateExternalConnection -> Text
$sel:domain:AssociateExternalConnection' :: AssociateExternalConnection -> Text
$sel:domainOwner:AssociateExternalConnection' :: AssociateExternalConnection -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
domainOwner
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
domain
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
repository
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
externalConnection
instance Prelude.NFData AssociateExternalConnection where
rnf :: AssociateExternalConnection -> ()
rnf AssociateExternalConnection' {Maybe Text
Text
externalConnection :: Text
repository :: Text
domain :: Text
domainOwner :: Maybe Text
$sel:externalConnection:AssociateExternalConnection' :: AssociateExternalConnection -> Text
$sel:repository:AssociateExternalConnection' :: AssociateExternalConnection -> Text
$sel:domain:AssociateExternalConnection' :: AssociateExternalConnection -> Text
$sel:domainOwner:AssociateExternalConnection' :: AssociateExternalConnection -> Maybe Text
..} =
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 Text
domain
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
repository
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
externalConnection
instance Data.ToHeaders AssociateExternalConnection where
toHeaders :: AssociateExternalConnection -> 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 AssociateExternalConnection where
toJSON :: AssociateExternalConnection -> Value
toJSON = forall a b. a -> b -> a
Prelude.const (Object -> Value
Data.Object forall a. Monoid a => a
Prelude.mempty)
instance Data.ToPath AssociateExternalConnection where
toPath :: AssociateExternalConnection -> ByteString
toPath =
forall a b. a -> b -> a
Prelude.const ByteString
"/v1/repository/external-connection"
instance Data.ToQuery AssociateExternalConnection where
toQuery :: AssociateExternalConnection -> QueryString
toQuery AssociateExternalConnection' {Maybe Text
Text
externalConnection :: Text
repository :: Text
domain :: Text
domainOwner :: Maybe Text
$sel:externalConnection:AssociateExternalConnection' :: AssociateExternalConnection -> Text
$sel:repository:AssociateExternalConnection' :: AssociateExternalConnection -> Text
$sel:domain:AssociateExternalConnection' :: AssociateExternalConnection -> Text
$sel:domainOwner:AssociateExternalConnection' :: AssociateExternalConnection -> 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,
ByteString
"external-connection" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
externalConnection
]
data AssociateExternalConnectionResponse = AssociateExternalConnectionResponse'
{
AssociateExternalConnectionResponse -> Maybe RepositoryDescription
repository :: Prelude.Maybe RepositoryDescription,
AssociateExternalConnectionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (AssociateExternalConnectionResponse
-> AssociateExternalConnectionResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociateExternalConnectionResponse
-> AssociateExternalConnectionResponse -> Bool
$c/= :: AssociateExternalConnectionResponse
-> AssociateExternalConnectionResponse -> Bool
== :: AssociateExternalConnectionResponse
-> AssociateExternalConnectionResponse -> Bool
$c== :: AssociateExternalConnectionResponse
-> AssociateExternalConnectionResponse -> Bool
Prelude.Eq, ReadPrec [AssociateExternalConnectionResponse]
ReadPrec AssociateExternalConnectionResponse
Int -> ReadS AssociateExternalConnectionResponse
ReadS [AssociateExternalConnectionResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssociateExternalConnectionResponse]
$creadListPrec :: ReadPrec [AssociateExternalConnectionResponse]
readPrec :: ReadPrec AssociateExternalConnectionResponse
$creadPrec :: ReadPrec AssociateExternalConnectionResponse
readList :: ReadS [AssociateExternalConnectionResponse]
$creadList :: ReadS [AssociateExternalConnectionResponse]
readsPrec :: Int -> ReadS AssociateExternalConnectionResponse
$creadsPrec :: Int -> ReadS AssociateExternalConnectionResponse
Prelude.Read, Int -> AssociateExternalConnectionResponse -> ShowS
[AssociateExternalConnectionResponse] -> ShowS
AssociateExternalConnectionResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociateExternalConnectionResponse] -> ShowS
$cshowList :: [AssociateExternalConnectionResponse] -> ShowS
show :: AssociateExternalConnectionResponse -> String
$cshow :: AssociateExternalConnectionResponse -> String
showsPrec :: Int -> AssociateExternalConnectionResponse -> ShowS
$cshowsPrec :: Int -> AssociateExternalConnectionResponse -> ShowS
Prelude.Show, forall x.
Rep AssociateExternalConnectionResponse x
-> AssociateExternalConnectionResponse
forall x.
AssociateExternalConnectionResponse
-> Rep AssociateExternalConnectionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AssociateExternalConnectionResponse x
-> AssociateExternalConnectionResponse
$cfrom :: forall x.
AssociateExternalConnectionResponse
-> Rep AssociateExternalConnectionResponse x
Prelude.Generic)
newAssociateExternalConnectionResponse ::
Prelude.Int ->
AssociateExternalConnectionResponse
newAssociateExternalConnectionResponse :: Int -> AssociateExternalConnectionResponse
newAssociateExternalConnectionResponse Int
pHttpStatus_ =
AssociateExternalConnectionResponse'
{ $sel:repository:AssociateExternalConnectionResponse' :: Maybe RepositoryDescription
repository =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:AssociateExternalConnectionResponse' :: Int
httpStatus = Int
pHttpStatus_
}
associateExternalConnectionResponse_repository :: Lens.Lens' AssociateExternalConnectionResponse (Prelude.Maybe RepositoryDescription)
associateExternalConnectionResponse_repository :: Lens'
AssociateExternalConnectionResponse (Maybe RepositoryDescription)
associateExternalConnectionResponse_repository = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateExternalConnectionResponse' {Maybe RepositoryDescription
repository :: Maybe RepositoryDescription
$sel:repository:AssociateExternalConnectionResponse' :: AssociateExternalConnectionResponse -> Maybe RepositoryDescription
repository} -> Maybe RepositoryDescription
repository) (\s :: AssociateExternalConnectionResponse
s@AssociateExternalConnectionResponse' {} Maybe RepositoryDescription
a -> AssociateExternalConnectionResponse
s {$sel:repository:AssociateExternalConnectionResponse' :: Maybe RepositoryDescription
repository = Maybe RepositoryDescription
a} :: AssociateExternalConnectionResponse)
associateExternalConnectionResponse_httpStatus :: Lens.Lens' AssociateExternalConnectionResponse Prelude.Int
associateExternalConnectionResponse_httpStatus :: Lens' AssociateExternalConnectionResponse Int
associateExternalConnectionResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateExternalConnectionResponse' {Int
httpStatus :: Int
$sel:httpStatus:AssociateExternalConnectionResponse' :: AssociateExternalConnectionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AssociateExternalConnectionResponse
s@AssociateExternalConnectionResponse' {} Int
a -> AssociateExternalConnectionResponse
s {$sel:httpStatus:AssociateExternalConnectionResponse' :: Int
httpStatus = Int
a} :: AssociateExternalConnectionResponse)
instance
Prelude.NFData
AssociateExternalConnectionResponse
where
rnf :: AssociateExternalConnectionResponse -> ()
rnf AssociateExternalConnectionResponse' {Int
Maybe RepositoryDescription
httpStatus :: Int
repository :: Maybe RepositoryDescription
$sel:httpStatus:AssociateExternalConnectionResponse' :: AssociateExternalConnectionResponse -> Int
$sel:repository:AssociateExternalConnectionResponse' :: AssociateExternalConnectionResponse -> 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