Skip to content

Commit

Permalink
change package name for generated code to kubernetes-openapi-client-g…
Browse files Browse the repository at this point in the history
…en. adapt existing code to the change
  • Loading branch information
guoshimin2 committed Feb 26, 2019
1 parent 9ac01d2 commit 1f4868f
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 26 deletions.
5 changes: 1 addition & 4 deletions kubernetes-client-helper/package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ library:
source-dirs: src
dependencies:
- base >=4.7 && <5.0
- kubernetes == 0.1.0.0
- kubernetes-openapi-client-gen == 0.1.0.0
- pem
- x509
- tls
Expand All @@ -19,6 +19,3 @@ dependencies:
- bytestring >=0.10.0 && <0.11
- text >=0.11 && <1.3
- safe-exceptions <0.2



20 changes: 10 additions & 10 deletions kubernetes-client-helper/src/Kubernetes/ClientHelper.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

module Kubernetes.ClientHelper where

import qualified Kubernetes.Core as K
import qualified Kubernetes.Model as K
import qualified Kubernetes.OpenAPI.Core as K
import qualified Kubernetes.OpenAPI.Model as K

import Control.Exception.Safe (Exception, MonadThrow, throwM)
import Control.Monad.IO.Class (MonadIO, liftIO)
Expand Down Expand Up @@ -32,23 +32,23 @@ import qualified Network.TLS.Extra as TLS
import System.Environment (getEnv)
import System.X509 (getSystemCertificateStore)

-- |Sets the master URI in the 'K.KubernetesConfig'.
-- |Sets the master URI in the 'K.KubernetesClientConfig'.
setMasterURI
:: T.Text -- ^ Master URI
-> K.KubernetesConfig
-> K.KubernetesConfig
-> K.KubernetesClientConfig
-> K.KubernetesClientConfig
setMasterURI server kcfg =
kcfg { K.configHost = (LazyB.fromStrict . T.encodeUtf8) server }

-- |Disables the client-side auth methods validation. This is necessary if you are using client cert authentication.
disableValidateAuthMethods :: K.KubernetesConfig -> K.KubernetesConfig
disableValidateAuthMethods :: K.KubernetesClientConfig -> K.KubernetesClientConfig
disableValidateAuthMethods kcfg = kcfg { K.configValidateAuthMethods = False }

-- |Configures the 'K.KubernetesConfig' to use token authentication.
-- |Configures the 'K.KubernetesClientConfig' to use token authentication.
setTokenAuth
:: T.Text -- ^Authentication token
-> K.KubernetesConfig
-> K.KubernetesConfig
-> K.KubernetesClientConfig
-> K.KubernetesClientConfig
setTokenAuth token kcfg = kcfg
{ K.configAuthMethods = [K.AnyAuthMethod (K.AuthApiKeyBearerToken $ "Bearer " <> token)]
}
Expand Down Expand Up @@ -124,7 +124,7 @@ loadPEMCerts p = do
serviceAccountDir :: FilePath
serviceAccountDir = "/var/run/secrets/kubernetes.io/serviceaccount"

cluster :: (MonadIO m, MonadThrow m) => m (NH.Manager, K.KubernetesConfig)
cluster :: (MonadIO m, MonadThrow m) => m (NH.Manager, K.KubernetesClientConfig)
cluster = do
caStore <- loadPEMCerts $ serviceAccountDir ++ "/ca.crt"
defTlsParams <- liftIO defaultTLSClientParams
Expand Down
2 changes: 1 addition & 1 deletion kubernetes-watch/package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ dependencies:
- mtl >=2.2.1
- streaming-bytestring >= 0.1.5 && < 0.2.0
- text >=0.11 && <1.3
- kubernetes == 0.1.0.0
- kubernetes-openapi-client-gen == 0.1.0.0


10 changes: 5 additions & 5 deletions kubernetes-watch/src/Kubernetes/Watch/Client.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import Data.Aeson
import qualified Data.ByteString as B
import qualified Data.ByteString.Streaming.Char8 as Q
import qualified Data.Text as T
import Kubernetes.Core
import Kubernetes.Client
import Kubernetes.MimeTypes
import Kubernetes.Model (Watch(..))
import Kubernetes.OpenAPI.Core
import Kubernetes.OpenAPI.Client
import Kubernetes.OpenAPI.MimeTypes
import Kubernetes.OpenAPI.Model (Watch(..))
import Network.HTTP.Client

data WatchEvent a = WatchEvent
Expand Down Expand Up @@ -66,7 +66,7 @@ Launching 'dispatchWatch' with the above we get a stream of endpoints data:
dispatchWatch ::
(HasOptionalParam req Watch, MimeType accept, MimeType contentType) =>
Manager
-> KubernetesConfig
-> KubernetesClientConfig
-> KubernetesRequest req contentType resp accept
-> (Q.ByteString IO () -> IO a)
-> IO a
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: kubernetes-openapi
name: kubernetes-openapi-client-gen
version: 0.1.0.0
synopsis: Auto-generated kubernetes-openapi API Client
synopsis: Auto-generated kubernetes-openapi-client-gen API Client
description: .
Client library for calling the Kubernetes API based on http-client.
.
Expand Down Expand Up @@ -57,7 +57,7 @@ library
, vector >=0.10.9 && <0.13
, katip >=0.4 && < 0.6
other-modules:
Paths_kubernetes_openapi
Paths_kubernetes_openapi_client_gen
exposed-modules:
Kubernetes.OpenAPI
Kubernetes.OpenAPI.API.Admissionregistration
Expand Down Expand Up @@ -127,7 +127,7 @@ test-suite tests
tests
ghc-options: -Wall -fno-warn-orphans
build-depends:
kubernetes-openapi
kubernetes-openapi-client-gen
, QuickCheck
, aeson
, base >=4.7 && <5.0
Expand Down
4 changes: 2 additions & 2 deletions kubernetes/lib/Kubernetes/OpenAPI/Core.hs
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,14 @@ instance P.Show KubernetesClientConfig where
--
-- configUserAgent:
--
-- @"kubernetes-openapi/0.1.0.0"@
-- @"kubernetes-openapi-client-gen/0.1.0.0"@
--
newConfig :: IO KubernetesClientConfig
newConfig = do
logCxt <- initLogContext
return $ KubernetesClientConfig
{ configHost = "https://localhost"
, configUserAgent = "kubernetes-openapi/0.1.0.0"
, configUserAgent = "kubernetes-openapi-client-gen/0.1.0.0"
, configLogExecWithContext = runDefaultLogExecWithContext
, configLogContext = logCxt
, configAuthMethods = []
Expand Down

0 comments on commit 1f4868f

Please sign in to comment.