scala.googleapis.bigquery.DifferentialPrivacyPolicy.scala Maven / Gradle / Ivy
package googleapis.bigquery
import io.circe._
import io.circe.syntax._
final case class DifferentialPrivacyPolicy(
/** Optional. The delta value that is used per query. Delta represents the probability that any row will fail to be epsilon differentially private. Indicates the risk associated with exposing aggregate rows in the result of a query.
*/
deltaPerQuery: Option[Double] = None,
/** Optional. The maximum groups contributed value that is used per query. Represents the maximum number of groups to which each protected entity can contribute. Changing this value does not improve or worsen privacy. The best value for accuracy and utility depends on the query and data.
*/
maxGroupsContributed: Option[Long] = None,
/** Optional. The total delta budget for all queries against the privacy-protected view. Each subscriber query against this view charges the amount of delta that is pre-defined by the contributor through the privacy policy delta_per_query field. If there is sufficient budget, then the subscriber query attempts to complete. It might still fail due to other reasons, in which case the charge is refunded. If there is insufficient budget the query is rejected. There might be multiple charge attempts if a single query references multiple views. In this case there must be sufficient budget for all charges or the query is rejected and charges are refunded in best effort. The budget does not have a refresh policy and can only be updated via ALTER VIEW or circumvented by creating a new view that can be queried with a fresh budget.
*/
deltaBudget: Option[Double] = None,
/** Output only. The delta budget remaining. If budget is exhausted, no more queries are allowed. Note that the budget for queries that are in progress is deducted before the query executes. If the query fails or is cancelled then the budget is refunded. In this case the amount of budget remaining can increase.
*/
deltaBudgetRemaining: Option[Double] = None,
/** Optional. The maximum epsilon value that a query can consume. If the subscriber specifies epsilon as a parameter in a SELECT query, it must be less than or equal to this value. The epsilon parameter controls the amount of noise that is added to the groups — a higher epsilon means less noise.
*/
maxEpsilonPerQuery: Option[Double] = None,
/** Optional. The privacy unit column associated with this policy. Differential privacy policies can only have one privacy unit column per data source object (table, view).
*/
privacyUnitColumn: Option[String] = None,
/** Optional. The total epsilon budget for all queries against the privacy-protected view. Each subscriber query against this view charges the amount of epsilon they request in their query. If there is sufficient budget, then the subscriber query attempts to complete. It might still fail due to other reasons, in which case the charge is refunded. If there is insufficient budget the query is rejected. There might be multiple charge attempts if a single query references multiple views. In this case there must be sufficient budget for all charges or the query is rejected and charges are refunded in best effort. The budget does not have a refresh policy and can only be updated via ALTER VIEW or circumvented by creating a new view that can be queried with a fresh budget.
*/
epsilonBudget: Option[Double] = None,
/** Output only. The epsilon budget remaining. If budget is exhausted, no more queries are allowed. Note that the budget for queries that are in progress is deducted before the query executes. If the query fails or is cancelled then the budget is refunded. In this case the amount of budget remaining can increase.
*/
epsilonBudgetRemaining: Option[Double] = None,
)
object DifferentialPrivacyPolicy {
implicit val encoder: Encoder[
DifferentialPrivacyPolicy
] = Encoder.instance { x =>
Json.obj(
"deltaPerQuery" := x.deltaPerQuery,
"maxGroupsContributed" := x.maxGroupsContributed,
"deltaBudget" := x.deltaBudget,
"deltaBudgetRemaining" := x.deltaBudgetRemaining,
"maxEpsilonPerQuery" :=
x.maxEpsilonPerQuery,
"privacyUnitColumn" := x.privacyUnitColumn,
"epsilonBudget" := x.epsilonBudget,
"epsilonBudgetRemaining" := x.epsilonBudgetRemaining,
)
}
implicit val decoder: Decoder[
DifferentialPrivacyPolicy
] = Decoder.instance { c =>
for {
v0 <- c.get[Option[Double]]("deltaPerQuery")
v1 <- c.get[Option[Long]]("maxGroupsContributed")
v2 <- c.get[Option[Double]]("deltaBudget")
v3 <- c.get[Option[Double]]("deltaBudgetRemaining")
v4 <- c.get[Option[Double]]("maxEpsilonPerQuery")
v5 <- c.get[Option[String]]("privacyUnitColumn")
v6 <- c.get[Option[Double]]("epsilonBudget")
v7 <- c.get[Option[Double]]("epsilonBudgetRemaining")
} yield DifferentialPrivacyPolicy(v0, v1, v2, v3, v4, v5, v6, v7)
}
}