Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: [google-cloud-confidentialcomputing] Add a token_type options proto to allow for customization of specific token types #13299

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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = "0.4.13" # {x-release-please-version}
__version__ = "0.0.0" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = "0.4.13" # {x-release-please-version}
__version__ = "0.0.0" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,14 @@ class TokenType(proto.Enum):
Public Key Infrastructure (PKI) token type
TOKEN_TYPE_LIMITED_AWS (3):
Limited claim token type for AWS integration
TOKEN_TYPE_AWS_PRINCIPALTAGS (4):
Principal-tag-based token for AWS integration
"""
TOKEN_TYPE_UNSPECIFIED = 0
TOKEN_TYPE_OIDC = 1
TOKEN_TYPE_PKI = 2
TOKEN_TYPE_LIMITED_AWS = 3
TOKEN_TYPE_AWS_PRINCIPALTAGS = 4


class Challenge(proto.Message):
Expand Down Expand Up @@ -347,7 +350,15 @@ class TokenOptions(proto.Message):
r"""Options to modify claims in the token to generate
custom-purpose tokens.


.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields

Attributes:
aws_principal_tags_options (google.cloud.confidentialcomputing_v1.types.TokenOptions.AwsPrincipalTagsOptions):
Optional. Options for the Limited AWS token
type.

This field is a member of `oneof`_ ``token_type_options``.
audience (str):
Optional. Optional string to issue the token
with a custom audience claim. Required if one or
Expand All @@ -362,6 +373,62 @@ class TokenOptions(proto.Message):
type of token to return.
"""

class AwsPrincipalTagsOptions(proto.Message):
r"""Token options that only apply to the AWS Principal Tags token
type.

Attributes:
allowed_principal_tags (google.cloud.confidentialcomputing_v1.types.TokenOptions.AwsPrincipalTagsOptions.AllowedPrincipalTags):
Optional. Principal tags to allow in the
token.
"""

class AllowedPrincipalTags(proto.Message):
r"""Allowed principal tags is used to define what principal tags
will be placed in the token.

Attributes:
container_image_signatures (google.cloud.confidentialcomputing_v1.types.TokenOptions.AwsPrincipalTagsOptions.AllowedPrincipalTags.ContainerImageSignatures):
Optional. Container image signatures allowed
in the token.
"""

class ContainerImageSignatures(proto.Message):
r"""Allowed Container Image Signatures. Key IDs are required to
allow this claim to fit within the narrow AWS IAM restrictions.

Attributes:
key_ids (MutableSequence[str]):
Optional. List of key ids to filter into the
Principal tags. Only keys that have been
validated and added to the token will be
filtered into principal tags. Unrecognized key
ids will be ignored.
"""

key_ids: MutableSequence[str] = proto.RepeatedField(
proto.STRING,
number=1,
)

container_image_signatures: "TokenOptions.AwsPrincipalTagsOptions.AllowedPrincipalTags.ContainerImageSignatures" = proto.Field(
proto.MESSAGE,
number=1,
message="TokenOptions.AwsPrincipalTagsOptions.AllowedPrincipalTags.ContainerImageSignatures",
)

allowed_principal_tags: "TokenOptions.AwsPrincipalTagsOptions.AllowedPrincipalTags" = proto.Field(
proto.MESSAGE,
number=1,
message="TokenOptions.AwsPrincipalTagsOptions.AllowedPrincipalTags",
)

aws_principal_tags_options: AwsPrincipalTagsOptions = proto.Field(
proto.MESSAGE,
number=4,
oneof="token_type_options",
message=AwsPrincipalTagsOptions,
)
audience: str = proto.Field(
proto.STRING,
number=1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-cloud-confidentialcomputing",
"version": "0.4.13"
"version": "0.1.0"
},
"snippets": [
{
Expand Down
Loading