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

feat: Secret Manager integration fields 'secret_environment_variables' and 'secret_volumes' added #130

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions google/cloud/functions/__init__.py
Expand Up @@ -36,6 +36,8 @@
from google.cloud.functions_v1.types.functions import HttpsTrigger
from google.cloud.functions_v1.types.functions import ListFunctionsRequest
from google.cloud.functions_v1.types.functions import ListFunctionsResponse
from google.cloud.functions_v1.types.functions import SecretEnvVar
from google.cloud.functions_v1.types.functions import SecretVolume
from google.cloud.functions_v1.types.functions import SourceRepository
from google.cloud.functions_v1.types.functions import UpdateFunctionRequest
from google.cloud.functions_v1.types.functions import CloudFunctionStatus
Expand All @@ -60,6 +62,8 @@
"HttpsTrigger",
"ListFunctionsRequest",
"ListFunctionsResponse",
"SecretEnvVar",
"SecretVolume",
"SourceRepository",
"UpdateFunctionRequest",
"CloudFunctionStatus",
Expand Down
4 changes: 4 additions & 0 deletions google/cloud/functions_v1/__init__.py
Expand Up @@ -32,6 +32,8 @@
from .types.functions import HttpsTrigger
from .types.functions import ListFunctionsRequest
from .types.functions import ListFunctionsResponse
from .types.functions import SecretEnvVar
from .types.functions import SecretVolume
from .types.functions import SourceRepository
from .types.functions import UpdateFunctionRequest
from .types.functions import CloudFunctionStatus
Expand Down Expand Up @@ -59,6 +61,8 @@
"ListFunctionsResponse",
"OperationMetadataV1",
"OperationType",
"SecretEnvVar",
"SecretVolume",
"SourceRepository",
"UpdateFunctionRequest",
)
Expand Up @@ -57,6 +57,14 @@ class CloudFunctionsServiceAsyncClient:
parse_cloud_function_path = staticmethod(
CloudFunctionsServiceClient.parse_cloud_function_path
)
crypto_key_path = staticmethod(CloudFunctionsServiceClient.crypto_key_path)
parse_crypto_key_path = staticmethod(
CloudFunctionsServiceClient.parse_crypto_key_path
)
repository_path = staticmethod(CloudFunctionsServiceClient.repository_path)
parse_repository_path = staticmethod(
CloudFunctionsServiceClient.parse_repository_path
)
common_billing_account_path = staticmethod(
CloudFunctionsServiceClient.common_billing_account_path
)
Expand Down Expand Up @@ -281,6 +289,7 @@ async def get_function(
contains user computation executed in
response to an event. It encapsulate
function and triggers configurations.
Next tag: 36

"""
# Create or coerce a protobuf request object.
Expand Down Expand Up @@ -373,7 +382,7 @@ async def create_function(

The result type for the operation will be :class:`google.cloud.functions_v1.types.CloudFunction` Describes a Cloud Function that contains user computation executed in
response to an event. It encapsulate function and
triggers configurations.
triggers configurations. Next tag: 36

"""
# Create or coerce a protobuf request object.
Expand Down Expand Up @@ -457,7 +466,7 @@ async def update_function(

The result type for the operation will be :class:`google.cloud.functions_v1.types.CloudFunction` Describes a Cloud Function that contains user computation executed in
response to an event. It encapsulate function and
triggers configurations.
triggers configurations. Next tag: 36

"""
# Create or coerce a protobuf request object.
Expand Down
Expand Up @@ -185,6 +185,43 @@ def parse_cloud_function_path(path: str) -> Dict[str, str]:
)
return m.groupdict() if m else {}

@staticmethod
def crypto_key_path(
project: str, location: str, key_ring: str, crypto_key: str,
) -> str:
"""Returns a fully-qualified crypto_key string."""
return "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}".format(
project=project,
location=location,
key_ring=key_ring,
crypto_key=crypto_key,
)

@staticmethod
def parse_crypto_key_path(path: str) -> Dict[str, str]:
"""Parses a crypto_key path into its component segments."""
m = re.match(
r"^projects/(?P<project>.+?)/locations/(?P<location>.+?)/keyRings/(?P<key_ring>.+?)/cryptoKeys/(?P<crypto_key>.+?)$",
path,
)
return m.groupdict() if m else {}

@staticmethod
def repository_path(project: str, location: str, repository: str,) -> str:
"""Returns a fully-qualified repository string."""
return "projects/{project}/locations/{location}/repositories/{repository}".format(
project=project, location=location, repository=repository,
)

@staticmethod
def parse_repository_path(path: str) -> Dict[str, str]:
"""Parses a repository path into its component segments."""
m = re.match(
r"^projects/(?P<project>.+?)/locations/(?P<location>.+?)/repositories/(?P<repository>.+?)$",
path,
)
return m.groupdict() if m else {}

@staticmethod
def common_billing_account_path(billing_account: str,) -> str:
"""Returns a fully-qualified billing_account string."""
Expand Down Expand Up @@ -455,6 +492,7 @@ def get_function(
contains user computation executed in
response to an event. It encapsulate
function and triggers configurations.
Next tag: 36

"""
# Create or coerce a protobuf request object.
Expand Down Expand Up @@ -537,7 +575,7 @@ def create_function(

The result type for the operation will be :class:`google.cloud.functions_v1.types.CloudFunction` Describes a Cloud Function that contains user computation executed in
response to an event. It encapsulate function and
triggers configurations.
triggers configurations. Next tag: 36

"""
# Create or coerce a protobuf request object.
Expand Down Expand Up @@ -621,7 +659,7 @@ def update_function(

The result type for the operation will be :class:`google.cloud.functions_v1.types.CloudFunction` Describes a Cloud Function that contains user computation executed in
response to an event. It encapsulate function and
triggers configurations.
triggers configurations. Next tag: 36

"""
# Create or coerce a protobuf request object.
Expand Down
4 changes: 4 additions & 0 deletions google/cloud/functions_v1/types/__init__.py
Expand Up @@ -29,6 +29,8 @@
HttpsTrigger,
ListFunctionsRequest,
ListFunctionsResponse,
SecretEnvVar,
SecretVolume,
SourceRepository,
UpdateFunctionRequest,
CloudFunctionStatus,
Expand All @@ -54,6 +56,8 @@
"HttpsTrigger",
"ListFunctionsRequest",
"ListFunctionsResponse",
"SecretEnvVar",
"SecretVolume",
"SourceRepository",
"UpdateFunctionRequest",
"CloudFunctionStatus",
Expand Down