diff --git a/build.sbt b/build.sbt index b08eeaf..d801b9a 100644 --- a/build.sbt +++ b/build.sbt @@ -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 @@ -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", diff --git a/src/main/scala/org/zalando/kanadi/api/EventTypes.scala b/src/main/scala/org/zalando/kanadi/api/EventTypes.scala index aa75098..60df66b 100644 --- a/src/main/scala/org/zalando/kanadi/api/EventTypes.scala +++ b/src/main/scala/org/zalando/kanadi/api/EventTypes.scala @@ -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 } } @@ -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 } } @@ -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 } } @@ -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 } } @@ -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 } } diff --git a/src/main/scala/org/zalando/kanadi/api/Events.scala b/src/main/scala/org/zalando/kanadi/api/Events.scala index 9b64d0d..dd9a37b 100644 --- a/src/main/scala/org/zalando/kanadi/api/Events.scala +++ b/src/main/scala/org/zalando/kanadi/api/Events.scala @@ -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 { @@ -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 } } diff --git a/src/main/scala/org/zalando/kanadi/api/Registry.scala b/src/main/scala/org/zalando/kanadi/api/Registry.scala index b430a07..f692055 100644 --- a/src/main/scala/org/zalando/kanadi/api/Registry.scala +++ b/src/main/scala/org/zalando/kanadi/api/Registry.scala @@ -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 } } @@ -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 } } diff --git a/src/main/scala/org/zalando/kanadi/api/Subscriptions.scala b/src/main/scala/org/zalando/kanadi/api/Subscriptions.scala index 368c13e..d65f5e1 100644 --- a/src/main/scala/org/zalando/kanadi/api/Subscriptions.scala +++ b/src/main/scala/org/zalando/kanadi/api/Subscriptions.scala @@ -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) } } @@ -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) } } @@ -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) } } @@ -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) } } @@ -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) } } @@ -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 } } @@ -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) } } @@ -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) } } @@ -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 } } @@ -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) } } diff --git a/src/main/scala/org/zalando/kanadi/api/package.scala b/src/main/scala/org/zalando/kanadi/api/package.scala index b0dc1c0..c89ba3d 100644 --- a/src/main/scala/org/zalando/kanadi/api/package.scala +++ b/src/main/scala/org/zalando/kanadi/api/package.scala @@ -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 { @@ -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 ") - else RawHeader("Authorization", s"Bearer ${oAuth2Token.token}") + CensoredRawHeader("Authorization", s"Bearer ${oAuth2Token.value}", "Bearer ") + else RawHeader("Authorization", s"Bearer ${oAuth2Token.value}") } private[api] def stripAuthToken(request: HttpRequest)(implicit kanadiHttpConfig: HttpConfig): HttpRequest = { @@ -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 } diff --git a/version.sbt b/version.sbt index 4116319..a29d4f0 100644 --- a/version.sbt +++ b/version.sbt @@ -1 +1 @@ -version := "0.3.6-SNAPSHOT" +version := "0.4.0-SNAPSHOT"