Skip to content

Commit

Permalink
Silence the more aggressive use analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
ennru committed Sep 18, 2023
1 parent 3dcea8a commit 129c70e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import akka.stream.Materializer
import akka.stream.alpakka.google.RequestSettings

import java.time.Clock
import scala.annotation.nowarn
import scala.concurrent.Future

@InternalApi
Expand All @@ -26,7 +27,7 @@ private[auth] object ComputeEngineCredentials {
private final class ComputeEngineCredentials(projectId: String)(implicit mat: Materializer)
extends OAuth2Credentials(projectId) {
override protected def getAccessToken()(implicit mat: Materializer,
settings: RequestSettings,
@nowarn("msg=never used") settings: RequestSettings,
clock: Clock): Future[AccessToken] =
GoogleComputeMetadata.getAccessToken()
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import com.typesafe.config.Config

import java.net.URI
import java.util
import scala.annotation.nowarn
import scala.concurrent.{ExecutionContext, Future}

@InternalApi
Expand All @@ -25,7 +26,8 @@ private[auth] final case class NoCredentials private (projectId: String, token:

private val futureToken = Future.successful(OAuth2BearerToken(token))

override def get()(implicit ec: ExecutionContext, settings: RequestSettings): Future[OAuth2BearerToken] =
override def get()(implicit @nowarn("msg=never used") ec: ExecutionContext,
@nowarn("msg=never used") settings: RequestSettings): Future[OAuth2BearerToken] =
futureToken

override def asGoogle(implicit ec: ExecutionContext, settings: RequestSettings): GoogleCredentials =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import akka.stream.{CompletionStrategy, Materializer, OverflowStrategy}
import com.google.auth.{Credentials => GoogleCredentials}

import java.time.Clock
import scala.annotation.nowarn
import scala.concurrent.{ExecutionContext, Future, Promise}

@InternalApi
Expand All @@ -28,7 +29,8 @@ private[auth] abstract class OAuth2Credentials(val projectId: String)(implicit m

private val tokenStream = stream.run()

override def get()(implicit ec: ExecutionContext, settings: RequestSettings): Future[OAuth2BearerToken] = {
override def get()(implicit @nowarn("msg=never used") ec: ExecutionContext,
settings: RequestSettings): Future[OAuth2BearerToken] = {
val token = Promise[OAuth2BearerToken]()
tokenStream ! TokenRequest(token, settings)
token.future
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import spray.json.DefaultJsonProtocol._
import spray.json.{JsonParser, RootJsonFormat}

import java.time.Clock
import scala.annotation.nowarn
import scala.concurrent.Future
import scala.io.Source

Expand Down Expand Up @@ -68,7 +69,7 @@ private final class UserAccessCredentials(clientId: String,
) extends OAuth2Credentials(projectId) {

override protected def getAccessToken()(implicit mat: Materializer,
settings: RequestSettings,
@nowarn("msg=never used") settings: RequestSettings,
clock: Clock): Future[AccessToken] = {
UserAccessMetadata.getAccessToken(clientId, clientSecret, refreshToken)
}
Expand Down

0 comments on commit 129c70e

Please sign in to comment.