@@ -86,6 +86,12 @@ module Docker.Client.Types (
86 , NetworkType(..)
86 , NetworkType(..)
87 , NetworkName
87 , NetworkName
88 , NetworkFilter(..)
88 , NetworkFilter(..)
90+ , defaultConnectConfig
91+ , EndpointSettings(..)
92+ , defaultEndpointSettings
94+ , defaultIPAMSettings
89 , EndpointConfig(..)
95 , EndpointConfig(..)
90 , Ulimit(..)
96 , Ulimit(..)
91 , ContainerResources(..)
97 , ContainerResources(..)
@@ -152,6 +158,7 @@ data Endpoint =
152 | RemoveNetworkEndpoint NetworkID
158 | RemoveNetworkEndpoint NetworkID
153 | ListNetworksEndpoint [NetworkFilter]
159 | ListNetworksEndpoint [NetworkFilter]
154 | InspectNetworkEndpoint NetworkID
160 | InspectNetworkEndpoint NetworkID
161+ | ConnectNetworkEndpoint NetworkID ConnectConfig
155 deriving (Eq, Show)
162 deriving (Eq, Show)
157-- | We should newtype this
164-- | We should newtype this
@@ -1019,6 +1026,50 @@ instance {-# OVERLAPPING #-} ToJSON [NetworkFilter] where
1019 toKV (NetworkFilterScope s) = "scope" .= [fromNetworkScope s]
1026 toKV (NetworkFilterScope s) = "scope" .= [fromNetworkScope s]
1020 toKV (NetworkFilterType t) = "type" .= [fromNetworkType t]
1027 toKV (NetworkFilterType t) = "type" .= [fromNetworkType t]
1029+data ConnectConfig = ConnectConfig
1030+ { connectContainer :: Text
1031+ , connectEndpointConfig :: EndpointSettings
1032+ } deriving (Eq, Show, Generic)
1034+instance ToJSON ConnectConfig where
1035+ toJSON = genericToJSON defaultOptions { fieldLabelModifier = drop 7 }
1037+defaultConnectConfig :: Text -> ConnectConfig
1038+defaultConnectConfig = flip ConnectConfig defaultEndpointSettings
1040+data EndpointSettings = EndpointSettings
1041+ { endpointIPAMConfig :: IPAMSettings
1042+ , endpointLinks :: [Text]
1043+ , endpointAliases :: [Text]
1044+ , endpointNetworkID :: Maybe Text
1045+ , endpointEndpointID :: Maybe Text
1046+ , endpointGateway :: Maybe Text
1047+ , endpointIPAddress :: Maybe Text
1048+ , endpointIPPrefixLen :: Maybe Int
1049+ , endpointIPv6Gateway :: Maybe Text
1050+ , endpointGlobalIPv6Address :: Maybe Text
1051+ , endpointGlobalIPv6PrefixLen :: Maybe Int
1052+ , endpointMacAddress :: Maybe Text
1053+ } deriving (Eq, Show, Generic)
1055+instance ToJSON EndpointSettings where
1056+ toJSON = genericToJSON defaultOptions { fieldLabelModifier = drop 8 }
1058+defaultEndpointSettings :: EndpointSettings
1059+defaultEndpointSettings = EndpointSettings defaultIPAMSettings [] [] Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing
1061+data IPAMSettings = IPAMSettings
1062+ { ipamIPv4Address :: Maybe Text
1063+ , ipamIPv6Address :: Maybe Text
1064+ , ipamLinkLocalIPs :: [Text]
1065+ } deriving (Eq, Show, Generic)
1067+instance ToJSON IPAMSettings where
1068+ toJSON = genericToJSON defaultOptions { fieldLabelModifier = drop 4 }
1070+defaultIPAMSettings :: IPAMSettings
1071+defaultIPAMSettings = IPAMSettings Nothing Nothing []
1022-- TOOD: Add support for SELinux Volume labels (eg. "ro,z" or "ro/Z")
1073-- TOOD: Add support for SELinux Volume labels (eg. "ro,z" or "ro/Z")
1023-- | Set permissions on volumes that you mount in the container.
1074-- | Set permissions on volumes that you mount in the container.
1024data VolumePermission = ReadWrite | ReadOnly deriving (Eq, Show, Generic)
1075data VolumePermission = ReadWrite | ReadOnly deriving (Eq, Show, Generic)