Skip to content
This repository has been archived by the owner on Jul 30, 2024. It is now read-only.

Commit

Permalink
Update Circe + Webmodels
Browse files Browse the repository at this point in the history
Signed-off-by: Matthew de Detrich <[email protected]>
  • Loading branch information
Matthew de Detrich committed Mar 13, 2019
1 parent 629ec48 commit 01a4cba
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 36 deletions.
10 changes: 5 additions & 5 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name := """kanadi"""

val akkaHttpVersion = "10.1.5"
val akkaStreamsJsonVersion = "0.2.0"
val akkaStreamsJsonVersion = "0.3.0"
val currentScalaVersion = "2.11.12"
val enumeratumCirceVersion = "1.5.12"
val circeVersion = "0.10.1"
val enumeratumCirceVersion = "1.5.20"
val circeVersion = "0.11.1"
val akkaVersion = "2.5.17"

scalaVersion in ThisBuild := currentScalaVersion
Expand Down Expand Up @@ -89,13 +89,13 @@ libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-slf4j" % akkaVersion,
"com.typesafe.akka" %% "akka-stream" % akkaVersion,
"org.mdedetrich" %% "censored-raw-header" % "0.2.0",
"org.mdedetrich" %% "webmodels" % "0.3.0",
"org.mdedetrich" %% "webmodels" % "0.5.0",
"com.beachape" %% "enumeratum-circe" % enumeratumCirceVersion,
"io.circe" %% "circe-java8" % circeVersion,
"io.circe" %% "circe-parser" % circeVersion,
"org.mdedetrich" %% "akka-stream-circe" % akkaStreamsJsonVersion,
"org.mdedetrich" %% "akka-http-circe" % akkaStreamsJsonVersion,
"de.heikoseeberger" %% "akka-http-circe" % "1.22.0",
"de.heikoseeberger" %% "akka-http-circe" % "1.25.2",
"com.iheart" %% "ficus" % "1.4.3",
"com.typesafe.scala-logging" %% "scala-logging" % "3.8.0",
"ch.qos.logback" % "logback-classic" % "1.1.7",
Expand Down
20 changes: 10 additions & 10 deletions src/main/scala/org/zalando/kanadi/api/EventTypes.scala
Original file line number Diff line number Diff line change
Expand Up @@ -339,13 +339,13 @@ case class EventTypes(baseUri: URI, oAuth2TokenProvider: Option[OAuth2TokenProvi
def list()(implicit flowId: FlowId = randomFlowId(), executionContext: ExecutionContext): Future[List[EventType]] = {
val uri = baseUri_.withPath(baseUri_.path / "event-types")

val baseHeaders = List(RawHeader(`X-Flow-ID`, flowId.id))
val baseHeaders = List(RawHeader(`X-Flow-ID`, flowId.value))

for {
headers <- oAuth2TokenProvider match {
case None => Future.successful(baseHeaders)
case Some(futureProvider) =>
futureProvider.provider().map { oAuth2Token =>
futureProvider.value().map { oAuth2Token =>
toHeader(oAuth2Token) +: baseHeaders
}
}
Expand Down Expand Up @@ -387,13 +387,13 @@ case class EventTypes(baseUri: URI, oAuth2TokenProvider: Option[OAuth2TokenProvi
executionContext: ExecutionContext): Future[Unit] = {
val uri = baseUri_.withPath(baseUri_.path / "event-types")

val baseHeaders = List(RawHeader(`X-Flow-ID`, flowId.id))
val baseHeaders = List(RawHeader(`X-Flow-ID`, flowId.value))

for {
headers <- oAuth2TokenProvider match {
case None => Future.successful(baseHeaders)
case Some(futureProvider) =>
futureProvider.provider().map { oAuth2Token =>
futureProvider.value().map { oAuth2Token =>
toHeader(oAuth2Token) +: baseHeaders
}
}
Expand Down Expand Up @@ -422,13 +422,13 @@ case class EventTypes(baseUri: URI, oAuth2TokenProvider: Option[OAuth2TokenProvi
val uri =
baseUri_.withPath(baseUri_.path / "event-types" / name.name)

val baseHeaders = List(RawHeader(`X-Flow-ID`, flowId.id))
val baseHeaders = List(RawHeader(`X-Flow-ID`, flowId.value))

for {
headers <- oAuth2TokenProvider match {
case None => Future.successful(baseHeaders)
case Some(futureProvider) =>
futureProvider.provider().map { oAuth2Token =>
futureProvider.value().map { oAuth2Token =>
toHeader(oAuth2Token) +: baseHeaders
}
}
Expand Down Expand Up @@ -463,13 +463,13 @@ case class EventTypes(baseUri: URI, oAuth2TokenProvider: Option[OAuth2TokenProvi
val uri =
baseUri_.withPath(baseUri_.path / "event-types" / name.name)

val baseHeaders = List(RawHeader(`X-Flow-ID`, flowId.id))
val baseHeaders = List(RawHeader(`X-Flow-ID`, flowId.value))

for {
headers <- oAuth2TokenProvider match {
case None => Future.successful(baseHeaders)
case Some(futureProvider) =>
futureProvider.provider().map { oAuth2Token =>
futureProvider.value().map { oAuth2Token =>
toHeader(oAuth2Token) +: baseHeaders
}
}
Expand Down Expand Up @@ -504,13 +504,13 @@ case class EventTypes(baseUri: URI, oAuth2TokenProvider: Option[OAuth2TokenProvi
val uri =
baseUri_.withPath(baseUri_.path / "event-types" / name.name)

val baseHeaders = List(RawHeader(`X-Flow-ID`, flowId.id))
val baseHeaders = List(RawHeader(`X-Flow-ID`, flowId.value))

for {
headers <- oAuth2TokenProvider match {
case None => Future.successful(baseHeaders)
case Some(futureProvider) =>
futureProvider.provider().map { oAuth2Token =>
futureProvider.value().map { oAuth2Token =>
toHeader(oAuth2Token) +: baseHeaders
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/org/zalando/kanadi/api/Events.scala
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ case class Events(baseUri: URI, oAuth2TokenProvider: Option[OAuth2TokenProvider]
val uri =
baseUri_.withPath(baseUri_.path / "event-types" / name.name / "events")

val baseHeaders = List(RawHeader(`X-Flow-ID`, flowId.id))
val baseHeaders = List(RawHeader(`X-Flow-ID`, flowId.value))

val finalEvents = if (fillMetadata) {
events.map {
Expand All @@ -298,7 +298,7 @@ case class Events(baseUri: URI, oAuth2TokenProvider: Option[OAuth2TokenProvider]
headers <- oAuth2TokenProvider match {
case None => Future.successful(baseHeaders)
case Some(futureProvider) =>
futureProvider.provider().map { oAuth2Token =>
futureProvider.value().map { oAuth2Token =>
toHeader(oAuth2Token) +: baseHeaders
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/main/scala/org/zalando/kanadi/api/Registry.scala
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ case class Registry(baseUri: URI, oAuth2TokenProvider: Option[OAuth2TokenProvide
val uri =
baseUri_.withPath(baseUri_.path / "registry" / "enrichment-strategies")

val baseHeaders = List(RawHeader(`X-Flow-ID`, flowId.id))
val baseHeaders = List(RawHeader(`X-Flow-ID`, flowId.value))

for {
headers <- oAuth2TokenProvider match {
case None => Future.successful(baseHeaders)
case Some(futureProvider) =>
futureProvider.provider().map { oAuth2Token =>
futureProvider.value().map { oAuth2Token =>
toHeader(oAuth2Token) +: baseHeaders
}
}
Expand Down Expand Up @@ -75,13 +75,13 @@ case class Registry(baseUri: URI, oAuth2TokenProvider: Option[OAuth2TokenProvide
val uri =
baseUri_.withPath(baseUri_.path / "registry" / "partition-strategies")

val baseHeaders = List(RawHeader(`X-Flow-ID`, flowId.id))
val baseHeaders = List(RawHeader(`X-Flow-ID`, flowId.value))

for {
headers <- oAuth2TokenProvider match {
case None => Future.successful(baseHeaders)
case Some(futureProvider) =>
futureProvider.provider().map { oAuth2Token =>
futureProvider.value().map { oAuth2Token =>
toHeader(oAuth2Token) +: baseHeaders
}
}
Expand Down
20 changes: 10 additions & 10 deletions src/main/scala/org/zalando/kanadi/api/Subscriptions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ case class Subscriptions(baseUri: URI, oAuth2TokenProvider: Option[OAuth2TokenPr
headers <- oAuth2TokenProvider match {
case None => Future.successful(baseHeaders(flowId))
case Some(futureProvider) =>
futureProvider.provider().map { oAuth2Token =>
futureProvider.value().map { oAuth2Token =>
toHeader(oAuth2Token) +: baseHeaders(flowId)
}
}
Expand Down Expand Up @@ -594,7 +594,7 @@ case class Subscriptions(baseUri: URI, oAuth2TokenProvider: Option[OAuth2TokenPr
headers <- oAuth2TokenProvider match {
case None => Future.successful(baseHeaders(flowId))
case Some(futureProvider) =>
futureProvider.provider().map { oAuth2Token =>
futureProvider.value().map { oAuth2Token =>
toHeader(oAuth2Token) +: baseHeaders(flowId)
}
}
Expand Down Expand Up @@ -631,7 +631,7 @@ case class Subscriptions(baseUri: URI, oAuth2TokenProvider: Option[OAuth2TokenPr
headers <- oAuth2TokenProvider match {
case None => Future.successful(baseHeaders(flowId))
case Some(futureProvider) =>
futureProvider.provider().map { oAuth2Token =>
futureProvider.value().map { oAuth2Token =>
toHeader(oAuth2Token) +: baseHeaders(flowId)
}
}
Expand Down Expand Up @@ -671,7 +671,7 @@ case class Subscriptions(baseUri: URI, oAuth2TokenProvider: Option[OAuth2TokenPr
headers <- oAuth2TokenProvider match {
case None => Future.successful(baseHeaders(flowId))
case Some(futureProvider) =>
futureProvider.provider().map { oAuth2Token =>
futureProvider.value().map { oAuth2Token =>
toHeader(oAuth2Token) +: baseHeaders(flowId)
}
}
Expand Down Expand Up @@ -706,7 +706,7 @@ case class Subscriptions(baseUri: URI, oAuth2TokenProvider: Option[OAuth2TokenPr
headers <- oAuth2TokenProvider match {
case None => Future.successful(baseHeaders(flowId))
case Some(futureProvider) =>
futureProvider.provider().map { oAuth2Token =>
futureProvider.value().map { oAuth2Token =>
toHeader(oAuth2Token) +: baseHeaders(flowId)
}
}
Expand Down Expand Up @@ -758,7 +758,7 @@ case class Subscriptions(baseUri: URI, oAuth2TokenProvider: Option[OAuth2TokenPr
headers <- oAuth2TokenProvider match {
case None => Future.successful(streamHeaders)
case Some(futureProvider) =>
futureProvider.provider().map { oAuth2Token =>
futureProvider.value().map { oAuth2Token =>
toHeader(oAuth2Token) +: streamHeaders
}
}
Expand Down Expand Up @@ -799,7 +799,7 @@ case class Subscriptions(baseUri: URI, oAuth2TokenProvider: Option[OAuth2TokenPr
headers <- oAuth2TokenProvider match {
case None => Future.successful(baseHeaders(flowId))
case Some(futureProvider) =>
futureProvider.provider().map { oAuth2Token =>
futureProvider.value().map { oAuth2Token =>
toHeader(oAuth2Token) +: baseHeaders(flowId)
}
}
Expand Down Expand Up @@ -922,7 +922,7 @@ case class Subscriptions(baseUri: URI, oAuth2TokenProvider: Option[OAuth2TokenPr
headers <- oAuth2TokenProvider match {
case None => Future.successful(baseHeaders(flowId))
case Some(futureProvider) =>
futureProvider.provider().map { oAuth2Token =>
futureProvider.value().map { oAuth2Token =>
toHeader(oAuth2Token) +: baseHeaders(flowId)
}
}
Expand Down Expand Up @@ -1072,7 +1072,7 @@ case class Subscriptions(baseUri: URI, oAuth2TokenProvider: Option[OAuth2TokenPr
headers <- oAuth2TokenProvider match {
case None => Future.successful(streamHeaders)
case Some(futureProvider) =>
futureProvider.provider().map { oAuth2Token =>
futureProvider.value().map { oAuth2Token =>
toHeader(oAuth2Token) +: streamHeaders
}
}
Expand Down Expand Up @@ -1515,7 +1515,7 @@ case class Subscriptions(baseUri: URI, oAuth2TokenProvider: Option[OAuth2TokenPr
headers <- oAuth2TokenProvider match {
case None => Future.successful(baseHeaders(flowId))
case Some(futureProvider) =>
futureProvider.provider().map { oAuth2Token =>
futureProvider.value().map { oAuth2Token =>
toHeader(oAuth2Token) +: baseHeaders(flowId)
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/main/scala/org/zalando/kanadi/api/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ package object api {
Printer.noSpaces.copy(dropNullValues = true)

def baseHeaders(flowId: FlowId) =
List(RawHeader(`X-Flow-ID`, flowId.id), `Accept-Encoding`(HttpEncodings.gzip, HttpEncodings.deflate))
List(RawHeader(`X-Flow-ID`, flowId.value), `Accept-Encoding`(HttpEncodings.gzip, HttpEncodings.deflate))

def decodeCompressed(response: HttpResponse): HttpResponse = {
val decoder = response.encoding match {
Expand All @@ -44,8 +44,8 @@ package object api {

private[api] def toHeader(oAuth2Token: OAuth2Token)(implicit kanadiHttpConfig: HttpConfig): HttpHeader = {
if (kanadiHttpConfig.censorOAuth2Token)
CensoredRawHeader("Authorization", s"Bearer ${oAuth2Token.token}", "Bearer <secret>")
else RawHeader("Authorization", s"Bearer ${oAuth2Token.token}")
CensoredRawHeader("Authorization", s"Bearer ${oAuth2Token.value}", "Bearer <secret>")
else RawHeader("Authorization", s"Bearer ${oAuth2Token.value}")
}

private[api] def stripAuthToken(request: HttpRequest)(implicit kanadiHttpConfig: HttpConfig): HttpRequest = {
Expand All @@ -59,7 +59,7 @@ package object api {

private[kanadi] implicit final val canLogFlowId: CanLog[FlowId] = new CanLog[FlowId] {
override def logMessage(originalMsg: String, flowId: FlowId): String = {
MDC.put("flow_id", flowId.id)
MDC.put("flow_id", flowId.value)
originalMsg
}

Expand Down
2 changes: 1 addition & 1 deletion version.sbt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version := "0.3.6-SNAPSHOT"
version := "0.4.0-SNAPSHOT"

0 comments on commit 01a4cba

Please sign in to comment.