{-# 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.Lens as Lens
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
(AssociateExternalConnection
-> AssociateExternalConnection -> Bool)
-> (AssociateExternalConnection
-> AssociateExternalConnection -> Bool)
-> Eq AssociateExternalConnection
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]
(Int -> ReadS AssociateExternalConnection)
-> ReadS [AssociateExternalConnection]
-> ReadPrec AssociateExternalConnection
-> ReadPrec [AssociateExternalConnection]
-> Read 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
(Int -> AssociateExternalConnection -> ShowS)
-> (AssociateExternalConnection -> String)
-> ([AssociateExternalConnection] -> ShowS)
-> Show AssociateExternalConnection
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.
AssociateExternalConnection -> Rep AssociateExternalConnection x)
-> (forall x.
Rep AssociateExternalConnection x -> AssociateExternalConnection)
-> Generic AssociateExternalConnection
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' :: Maybe Text -> Text -> Text -> Text -> AssociateExternalConnection
AssociateExternalConnection'
{ $sel:domainOwner:AssociateExternalConnection' :: Maybe Text
domainOwner =
Maybe Text
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 :: (Maybe Text -> f (Maybe Text))
-> AssociateExternalConnection -> f AssociateExternalConnection
associateExternalConnection_domainOwner = (AssociateExternalConnection -> Maybe Text)
-> (AssociateExternalConnection
-> Maybe Text -> AssociateExternalConnection)
-> Lens
AssociateExternalConnection
AssociateExternalConnection
(Maybe Text)
(Maybe Text)
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 :: (Text -> f Text)
-> AssociateExternalConnection -> f AssociateExternalConnection
associateExternalConnection_domain = (AssociateExternalConnection -> Text)
-> (AssociateExternalConnection
-> Text -> AssociateExternalConnection)
-> Lens
AssociateExternalConnection AssociateExternalConnection Text Text
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 :: (Text -> f Text)
-> AssociateExternalConnection -> f AssociateExternalConnection
associateExternalConnection_repository = (AssociateExternalConnection -> Text)
-> (AssociateExternalConnection
-> Text -> AssociateExternalConnection)
-> Lens
AssociateExternalConnection AssociateExternalConnection Text Text
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 :: (Text -> f Text)
-> AssociateExternalConnection -> f AssociateExternalConnection
associateExternalConnection_externalConnection = (AssociateExternalConnection -> Text)
-> (AssociateExternalConnection
-> Text -> AssociateExternalConnection)
-> Lens
AssociateExternalConnection AssociateExternalConnection Text Text
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 :: AssociateExternalConnection -> Request AssociateExternalConnection
request = Service
-> AssociateExternalConnection
-> Request AssociateExternalConnection
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy AssociateExternalConnection
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AssociateExternalConnection)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse AssociateExternalConnection))
-> Logger
-> Service
-> Proxy AssociateExternalConnection
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AssociateExternalConnection)))
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 -> AssociateExternalConnectionResponse
AssociateExternalConnectionResponse'
(Maybe RepositoryDescription
-> Int -> AssociateExternalConnectionResponse)
-> Either String (Maybe RepositoryDescription)
-> Either String (Int -> AssociateExternalConnectionResponse)
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 -> AssociateExternalConnectionResponse)
-> Either String Int
-> Either String AssociateExternalConnectionResponse
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 AssociateExternalConnection
instance Prelude.NFData AssociateExternalConnection
instance Core.ToHeaders AssociateExternalConnection where
toHeaders :: AssociateExternalConnection -> ResponseHeaders
toHeaders =
ResponseHeaders -> AssociateExternalConnection -> 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 AssociateExternalConnection where
toJSON :: AssociateExternalConnection -> Value
toJSON = Value -> AssociateExternalConnection -> Value
forall a b. a -> b -> a
Prelude.const (Object -> Value
Core.Object Object
forall a. Monoid a => a
Prelude.mempty)
instance Core.ToPath AssociateExternalConnection where
toPath :: AssociateExternalConnection -> ByteString
toPath =
ByteString -> AssociateExternalConnection -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/v1/repository/external-connection"
instance Core.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
..} =
[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,
ByteString
"external-connection" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
externalConnection
]
data AssociateExternalConnectionResponse = AssociateExternalConnectionResponse'
{
AssociateExternalConnectionResponse -> Maybe RepositoryDescription
repository :: Prelude.Maybe RepositoryDescription,
AssociateExternalConnectionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (AssociateExternalConnectionResponse
-> AssociateExternalConnectionResponse -> Bool
(AssociateExternalConnectionResponse
-> AssociateExternalConnectionResponse -> Bool)
-> (AssociateExternalConnectionResponse
-> AssociateExternalConnectionResponse -> Bool)
-> Eq AssociateExternalConnectionResponse
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]
(Int -> ReadS AssociateExternalConnectionResponse)
-> ReadS [AssociateExternalConnectionResponse]
-> ReadPrec AssociateExternalConnectionResponse
-> ReadPrec [AssociateExternalConnectionResponse]
-> Read 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
(Int -> AssociateExternalConnectionResponse -> ShowS)
-> (AssociateExternalConnectionResponse -> String)
-> ([AssociateExternalConnectionResponse] -> ShowS)
-> Show AssociateExternalConnectionResponse
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.
AssociateExternalConnectionResponse
-> Rep AssociateExternalConnectionResponse x)
-> (forall x.
Rep AssociateExternalConnectionResponse x
-> AssociateExternalConnectionResponse)
-> Generic AssociateExternalConnectionResponse
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' :: Maybe RepositoryDescription
-> Int -> AssociateExternalConnectionResponse
AssociateExternalConnectionResponse'
{ $sel:repository:AssociateExternalConnectionResponse' :: Maybe RepositoryDescription
repository =
Maybe RepositoryDescription
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:AssociateExternalConnectionResponse' :: Int
httpStatus = Int
pHttpStatus_
}
associateExternalConnectionResponse_repository :: Lens.Lens' AssociateExternalConnectionResponse (Prelude.Maybe RepositoryDescription)
associateExternalConnectionResponse_repository :: (Maybe RepositoryDescription -> f (Maybe RepositoryDescription))
-> AssociateExternalConnectionResponse
-> f AssociateExternalConnectionResponse
associateExternalConnectionResponse_repository = (AssociateExternalConnectionResponse
-> Maybe RepositoryDescription)
-> (AssociateExternalConnectionResponse
-> Maybe RepositoryDescription
-> AssociateExternalConnectionResponse)
-> Lens
AssociateExternalConnectionResponse
AssociateExternalConnectionResponse
(Maybe RepositoryDescription)
(Maybe RepositoryDescription)
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 :: (Int -> f Int)
-> AssociateExternalConnectionResponse
-> f AssociateExternalConnectionResponse
associateExternalConnectionResponse_httpStatus = (AssociateExternalConnectionResponse -> Int)
-> (AssociateExternalConnectionResponse
-> Int -> AssociateExternalConnectionResponse)
-> Lens
AssociateExternalConnectionResponse
AssociateExternalConnectionResponse
Int
Int
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