Skip to content
This repository was archived by the owner on Sep 5, 2023. It is now read-only.

Commit 711e132

Browse files
feat: support secret and encrypted environment variables in v1 (#83)
* docs: updated documentation for message NetworkInterface chore: published new fields in service YAML PiperOrigin-RevId: 496547510 Source-Link: googleapis/googleapis@de57a4d Source-Link: https://github.com/googleapis/googleapis-gen/commit/b0b063a41cdd4748befc970f5b6405fdaf1d0470 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjBiMDYzYTQxY2RkNDc0OGJlZmM5NzBmNWI2NDA1ZmRhZjFkMDQ3MCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * docs: updated documentation for message NetworkInterface chore: published new fields in service YAML PiperOrigin-RevId: 496547521 Source-Link: googleapis/googleapis@cffce73 Source-Link: https://github.com/googleapis/googleapis-gen/commit/b35f4a31b293eace07aeed2a3fcf1d29db77e948 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjM1ZjRhMzFiMjkzZWFjZTA3YWVlZDJhM2ZjZjFkMjlkYjc3ZTk0OCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * feat: support secret and encrypted environment variables in v1 PiperOrigin-RevId: 499338464 Source-Link: googleapis/googleapis@af050dc Source-Link: https://github.com/googleapis/googleapis-gen/commit/413df7a1d735359d333c56e19f6af9c7f95957e4 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNDEzZGY3YTFkNzM1MzU5ZDMzM2M1NmUxOWY2YWY5YzdmOTU5NTdlNCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 113bfd5 commit 711e132

File tree

6 files changed

+86
-8
lines changed

6 files changed

+86
-8
lines changed

google/cloud/batch_v1/types/job.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -611,9 +611,21 @@ class NetworkInterface(proto.Message):
611611
612612
Attributes:
613613
network (str):
614-
The URL of the network resource.
614+
The URL of an existing network resource.
615+
You can specify the network as a full or partial
616+
URL. For example, the following are all valid
617+
URLs:
618+
https://www.googleapis.com/compute/v1/projects/{project}/global/networks/{network}
619+
projects/{project}/global/networks/{network}
620+
global/networks/{network}
615621
subnetwork (str):
616-
The URL of the Subnetwork resource.
622+
The URL of an existing subnetwork resource in
623+
the network. You can specify the subnetwork as a
624+
full or partial URL. For example, the following
625+
are all valid URLs:
626+
https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/subnetworks/{subnetwork}
627+
projects/{project}/regions/{region}/subnetworks/{subnetwork}
628+
regions/{region}/subnetworks/{subnetwork}
617629
no_external_ip_address (bool):
618630
Default is false (with an external IP
619631
address). Required if no external public IP

google/cloud/batch_v1/types/task.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,13 +528,53 @@ class Environment(proto.Message):
528528
variables (MutableMapping[str, str]):
529529
A map of environment variable names to
530530
values.
531+
secret_variables (MutableMapping[str, str]):
532+
A map of environment variable names to Secret
533+
Manager secret names. The VM will access the
534+
named secrets to set the value of each
535+
environment variable.
536+
encrypted_variables (google.cloud.batch_v1.types.Environment.KMSEnvMap):
537+
An encrypted JSON dictionary where the
538+
key/value pairs correspond to environment
539+
variable names and their values.
531540
"""
532541

542+
class KMSEnvMap(proto.Message):
543+
r"""
544+
545+
Attributes:
546+
key_name (str):
547+
The name of the KMS key that will be used to
548+
decrypt the cipher text.
549+
cipher_text (str):
550+
The value of the cipherText response from the ``encrypt``
551+
method.
552+
"""
553+
554+
key_name: str = proto.Field(
555+
proto.STRING,
556+
number=1,
557+
)
558+
cipher_text: str = proto.Field(
559+
proto.STRING,
560+
number=2,
561+
)
562+
533563
variables: MutableMapping[str, str] = proto.MapField(
534564
proto.STRING,
535565
proto.STRING,
536566
number=1,
537567
)
568+
secret_variables: MutableMapping[str, str] = proto.MapField(
569+
proto.STRING,
570+
proto.STRING,
571+
number=2,
572+
)
573+
encrypted_variables: KMSEnvMap = proto.Field(
574+
proto.MESSAGE,
575+
number=3,
576+
message=KMSEnvMap,
577+
)
538578

539579

540580
__all__ = tuple(sorted(__protobuf__.manifest))

google/cloud/batch_v1alpha/types/job.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -713,9 +713,21 @@ class NetworkInterface(proto.Message):
713713
714714
Attributes:
715715
network (str):
716-
The URL of the network resource.
716+
The URL of an existing network resource.
717+
You can specify the network as a full or partial
718+
URL. For example, the following are all valid
719+
URLs:
720+
https://www.googleapis.com/compute/v1/projects/{project}/global/networks/{network}
721+
projects/{project}/global/networks/{network}
722+
global/networks/{network}
717723
subnetwork (str):
718-
The URL of the Subnetwork resource.
724+
The URL of an existing subnetwork resource in
725+
the network. You can specify the subnetwork as a
726+
full or partial URL. For example, the following
727+
are all valid URLs:
728+
https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/subnetworks/{subnetwork}
729+
projects/{project}/regions/{region}/subnetworks/{subnetwork}
730+
regions/{region}/subnetworks/{subnetwork}
719731
no_external_ip_address (bool):
720732
Default is false (with an external IP
721733
address). Required if no external public IP

samples/generated_samples/snippet_metadata_google.cloud.batch.v1.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
],
99
"language": "PYTHON",
1010
"name": "google-cloud-batch",
11-
"version": "0.6.0"
11+
"version": "0.1.0"
1212
},
1313
"snippets": [
1414
{

samples/generated_samples/snippet_metadata_google.cloud.batch.v1alpha.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
],
99
"language": "PYTHON",
1010
"name": "google-cloud-batch",
11-
"version": "0.6.0"
11+
"version": "0.1.0"
1212
},
1313
"snippets": [
1414
{

tests/unit/gapic/batch_v1/test_batch_service.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2543,7 +2543,14 @@ def test_create_job_rest(request_type):
25432543
"ignore_exit_status": True,
25442544
"background": True,
25452545
"always_run": True,
2546-
"environment": {"variables": {}},
2546+
"environment": {
2547+
"variables": {},
2548+
"secret_variables": {},
2549+
"encrypted_variables": {
2550+
"key_name": "key_name_value",
2551+
"cipher_text": "cipher_text_value",
2552+
},
2553+
},
25472554
"timeout": {"seconds": 751, "nanos": 543},
25482555
}
25492556
],
@@ -2878,7 +2885,14 @@ def test_create_job_rest_bad_request(
28782885
"ignore_exit_status": True,
28792886
"background": True,
28802887
"always_run": True,
2881-
"environment": {"variables": {}},
2888+
"environment": {
2889+
"variables": {},
2890+
"secret_variables": {},
2891+
"encrypted_variables": {
2892+
"key_name": "key_name_value",
2893+
"cipher_text": "cipher_text_value",
2894+
},
2895+
},
28822896
"timeout": {"seconds": 751, "nanos": 543},
28832897
}
28842898
],

0 commit comments

Comments
 (0)