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: Added the VertexAiResourceNoun.to_dict() method #588

Merged
merged 7 commits into from Aug 9, 2021
Merged
Changes from 1 commit
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
5 changes: 5 additions & 0 deletions google/cloud/aiplatform/base.py
Expand Up @@ -44,6 +44,7 @@
from google.cloud.aiplatform import initializer
from google.cloud.aiplatform import utils
from google.cloud.aiplatform.compat.types import encryption_spec as gca_encryption_spec
from google.protobuf import json_format

logging.basicConfig(level=logging.INFO, stream=sys.stdout)

Expand Down Expand Up @@ -607,6 +608,10 @@ def _assert_gca_resource_is_available(self) -> None:
def __repr__(self) -> str:
return f"{object.__repr__(self)} \nresource name: {self.resource_name}"

def to_dict(self) -> dict:
Ark-kun marked this conversation as resolved.
Show resolved Hide resolved
"""Returns the resource proto as a dictionary."""
return json_format.MessageToDict(self.gca_resource._pb)


def optional_sync(
construct_object_on_arg: Optional[str] = None,
Expand Down