-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Deployment Images for Reporting V2 (#1099)
- Loading branch information
1 parent
e34c15b
commit 5eac37b
Showing
17 changed files
with
777 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/main/kotlin/org/wfanet/measurement/reporting/deploy/v2/common/BUILD.bazel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
load("@io_bazel_rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library") | ||
|
||
package( | ||
default_visibility = [ | ||
"//src/main/kotlin/org/wfanet/measurement/reporting:__subpackages__", | ||
"//src/test/kotlin/org/wfanet/measurement/reporting:__subpackages__", | ||
], | ||
) | ||
|
||
kt_jvm_library( | ||
name = "encryption_key_pair_map", | ||
srcs = ["EncryptionKeyPairMap.kt"], | ||
deps = [ | ||
"//src/main/proto/wfa/measurement/config/reporting:encryption_key_pair_config_kt_jvm_proto", | ||
"@wfa_common_jvm//imports/java/picocli", | ||
"@wfa_common_jvm//src/main/kotlin/org/wfanet/measurement/common/crypto/tink", | ||
], | ||
) | ||
|
||
kt_jvm_library( | ||
name = "flags", | ||
srcs = ["InternalApiFlags.kt"], | ||
deps = [ | ||
"@wfa_common_jvm//imports/java/picocli", | ||
], | ||
) | ||
|
||
kt_jvm_library( | ||
name = "kingdom_flags", | ||
srcs = ["KingdomApiFlags.kt"], | ||
deps = [ | ||
"@wfa_common_jvm//imports/java/picocli", | ||
], | ||
) |
57 changes: 57 additions & 0 deletions
57
src/main/kotlin/org/wfanet/measurement/reporting/deploy/v2/common/EncryptionKeyPairMap.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* Copyright 2023 The Cross-Media Measurement Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.wfanet.measurement.reporting.deploy.v2.common | ||
|
||
import com.google.protobuf.ByteString | ||
import java.io.File | ||
import org.wfanet.measurement.common.crypto.PrivateKeyHandle | ||
import org.wfanet.measurement.common.crypto.tink.loadPrivateKey | ||
import org.wfanet.measurement.common.parseTextProto | ||
import org.wfanet.measurement.common.readByteString | ||
import org.wfanet.measurement.config.reporting.encryptionKeyPairConfig | ||
import picocli.CommandLine.Option | ||
|
||
class EncryptionKeyPairMap { | ||
@Option( | ||
names = ["--key-pair-dir"], | ||
description = ["Path to the directory of MeasurementConsumer's encryption keys"], | ||
) | ||
private lateinit var keyFilesDirectory: File | ||
|
||
@Option( | ||
names = ["--key-pair-config-file"], | ||
description = ["Path to the textproto file of EncryptionKeyPairConfig that contains key pairs"], | ||
required = true | ||
) | ||
private lateinit var keyPairConfigFile: File | ||
|
||
private fun loadKeyPairs(): Map<String, List<Pair<ByteString, PrivateKeyHandle>>> { | ||
val keyPairConfig = | ||
parseTextProto(keyPairConfigFile, encryptionKeyPairConfig {}).principalKeyPairsList | ||
return keyPairConfig.associate { config -> | ||
val keyPairs = | ||
config.keyPairsList.map { keyPair -> | ||
val publicKey = keyFilesDirectory.resolve(keyPair.publicKeyFile).readByteString() | ||
val privateKey = loadPrivateKey(keyFilesDirectory.resolve(keyPair.privateKeyFile)) | ||
publicKey to privateKey | ||
} | ||
checkNotNull(config.principal) to keyPairs | ||
} | ||
} | ||
|
||
val keyPairs: Map<String, List<Pair<ByteString, PrivateKeyHandle>>> by lazy { loadKeyPairs() } | ||
} |
40 changes: 40 additions & 0 deletions
40
src/main/kotlin/org/wfanet/measurement/reporting/deploy/v2/common/InternalApiFlags.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright 2023 The Cross-Media Measurement Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.wfanet.measurement.reporting.deploy.v2.common | ||
|
||
import picocli.CommandLine | ||
|
||
class InternalApiFlags { | ||
@set:CommandLine.Option( | ||
names = ["--internal-api-target"], | ||
description = ["gRPC target (authority) of the Reporting internal API server"], | ||
required = true, | ||
) | ||
lateinit var target: String | ||
|
||
@CommandLine.Option( | ||
names = ["--internal-api-cert-host"], | ||
description = | ||
[ | ||
"Expected hostname (DNS-ID) in the Reporting internal API server's TLS certificate.", | ||
"This overrides derivation of the TLS DNS-ID from --internal-api-target.", | ||
], | ||
required = false, | ||
) | ||
var certHost: String? = null | ||
private set | ||
} |
40 changes: 40 additions & 0 deletions
40
src/main/kotlin/org/wfanet/measurement/reporting/deploy/v2/common/KingdomApiFlags.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright 2023 The Cross-Media Measurement Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.wfanet.measurement.reporting.deploy.v2.common | ||
|
||
import picocli.CommandLine | ||
|
||
class KingdomApiFlags { | ||
@set:CommandLine.Option( | ||
names = ["--kingdom-api-target"], | ||
description = ["gRPC target (authority) of the Kingdom public API server"], | ||
required = true, | ||
) | ||
lateinit var target: String | ||
|
||
@CommandLine.Option( | ||
names = ["--kingdom-api-cert-host"], | ||
description = | ||
[ | ||
"Expected hostname (DNS-ID) in the Kingdom public API server's TLS certificate.", | ||
"This overrides derivation of the TLS DNS-ID from --kingdom-api-target.", | ||
], | ||
required = false, | ||
) | ||
var certHost: String? = null | ||
private set | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
...otlin/org/wfanet/measurement/reporting/deploy/v2/common/server/ReportingApiServerFlags.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Copyright 2023 The Cross-Media Measurement Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.wfanet.measurement.reporting.deploy.v2.common.server | ||
|
||
import java.time.Duration | ||
import kotlin.properties.Delegates | ||
import org.wfanet.measurement.reporting.deploy.v2.common.InternalApiFlags | ||
import picocli.CommandLine | ||
|
||
class ReportingApiServerFlags { | ||
@CommandLine.Mixin | ||
lateinit var internalApiFlags: InternalApiFlags | ||
private set | ||
|
||
@set:CommandLine.Option( | ||
names = ["--debug-verbose-grpc-client-logging"], | ||
description = ["Enables full gRPC request and response logging for outgoing gRPCs"], | ||
defaultValue = "false" | ||
) | ||
var debugVerboseGrpcClientLogging by Delegates.notNull<Boolean>() | ||
private set | ||
|
||
@CommandLine.Option( | ||
names = ["--event-group-metadata-descriptor-cache-duration"], | ||
description = | ||
[ | ||
"How long the event group metadata descriptors are cached for before refreshing in format 1d1h1m1s1ms1ns" | ||
], | ||
defaultValue = "1h", | ||
required = false, | ||
) | ||
lateinit var eventGroupMetadataDescriptorCacheDuration: Duration | ||
private set | ||
} |
Oops, something went wrong.