xref: /aosp_15_r20/external/tink/python/examples/gcs/BUILD.bazel (revision e7b1675dde1b92d52ec075b0a92829627f2c52a5)
1load("@rules_python//python:defs.bzl", "py_binary")
2load("@pip_deps//:requirements.bzl", "requirement")
3
4package(default_visibility = ["//visibility:private"])
5
6licenses(["notice"])
7
8py_binary(
9    name = "gcs_envelope_aead",
10    srcs = ["gcs_envelope_aead.py"],
11    python_version = "PY3",
12    deps = [
13        requirement("absl-py"),
14        requirement("google-cloud-storage"),
15        "@tink_py//tink:tink_python",
16        "@tink_py//tink/integration/gcpkms",
17    ],
18)
19
20# In order to run this test, use your own Cloud KMS key and credential:
21sh_test(
22    name = "gcs_envelope_aead_test",
23    size = "small",
24    srcs = ["gcs_envelope_aead_test.sh"],
25    args = [
26        "$(rootpath :gcs_envelope_aead)",
27        # Change this to your key.
28        "gcp-kms://projects/tink-test-infrastructure/locations/global/keyRings/unit-and-integration-testing/cryptoKeys/aead-key",
29        # Change this to your credential.
30        "$(rootpath //testdata/gcp:credential.json)",
31        # Change this to your project ID.
32        "tink-test-infrastructure",
33        # Change this to your GCS bucket.
34        "gs://tink-gcs-examples",
35    ],
36    data = [
37        ":gcs_envelope_aead",
38        "@google_root_pem//file",
39        # Change this to your credential.
40        "//testdata/gcp:credential.json",
41    ],
42    tags = ["manual"],
43)
44
45# This runs the previous test, assuming the Tink python package has been
46# installed previously with pip3 install.
47sh_test(
48    name = "gcs_envelope_aead_test_package",
49    size = "small",
50    srcs = ["gcs_envelope_aead_test.sh"],
51    args = [
52        "'python3 $(rootpath :gcs_envelope_aead.py)'",
53        # Change this to your key
54        "gcp-kms://projects/tink-test-infrastructure/locations/global/keyRings/unit-and-integration-testing/cryptoKeys/aead-key",
55        # Change this to your credential
56        "$(rootpath //testdata/gcp:credential.json)",
57        # Change this to your project ID
58        "tink-test-infrastructure",
59        # Change this to your GCS bucket
60        "gs://tink-gcs-examples",
61    ],
62    data = [
63        ":gcs_envelope_aead.py",
64        "@google_root_pem//file",
65        # Change this to your credential.
66        "//testdata/gcp:credential.json",
67    ],
68    tags = ["manual"],
69)
70