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: add metadata models #19

Merged
merged 19 commits into from
Aug 27, 2021
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

.gradle/
.idea/
.project/
build/
generated-protos/

Expand Down
13 changes: 13 additions & 0 deletions .settings/org.eclipse.buildship.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
arguments=
auto.sync=false
build.scans.enabled=false
connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
connection.project.dir=
eclipse.preferences.version=1
gradle.user.home=
java.home=/usr/local/Cellar/openjdk/16.0.2/libexec/openjdk.jdk/Contents/Home
jvm.arguments=
offline.mode=false
override.workspace.settings=true
show.console.view=true
show.executions.view=true
94 changes: 94 additions & 0 deletions odpf/assets/bucket.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
syntax = "proto3";

package odpf.assets;

option java_package = "io.odpf.assets";
option java_outer_classname = "BucketProto";
option go_package = "github.com/odpf/proton/assets";

import "google/protobuf/timestamp.proto";

import "odpf/assets/facets/ownership.proto";
import "odpf/assets/facets/lineage.proto";
import "odpf/assets/facets/properties.proto";

import "odpf/assets/common/resource.proto";
import "odpf/assets/common/timestamp.proto";
import "odpf/assets/common/event.proto";

message Bucket {
// Representation of the resource
odpf.assets.common.Resource resource = 1;

// The description of the bucket.
// Example: `This bucket was created by the product team.`
string description = 4;

// The location of the bucket. Can differ based on cloud storage used. (e.g. GCS, S3, etc)
// Example: `ASIA`
string location = 5;

// The type of the storage. Can differ based on cloud storage used. (e.g. GCS, S3, etc)
// Example: `STANDARD`
string storage_type = 6;

// List of blobs in the bucket.
repeated Blob blobs = 7;

// The ownership of the bucket.
// For an example check out ownership.
odpf.assets.facets.Ownership ownership = 31;

// List of the user's custom properties.
// Properties facet can be used to set custom properties, tags and labels for a user.
odpf.assets.facets.Properties properties = 32;

// The timestamp of the bucket's creation.
// Timstamp facet can be used to set the creation and updation timestamp of a bucket.
odpf.assets.common.Timestamp timestamps = 33;

// The timestamp of the generated event.
// Event schemas is defined in the common event schema.
odpf.assets.common.Event event = 100;

}

message Blob {
// The URN of the blob.
// Example: `location/bucket-name/file-name`.
string urn = 1;

// The name of the blob.
// Example: `file-name`.
string name = 2;

// The source of the blob.
// Example: `gcs`.
string source = 3;

// The description of the blob.
// Example: `This is a config file for x app`
string description = 4;

// The length of the object content.
// Example: `300`
int64 size = 5;

// Delete time of the blob object.
google.protobuf.Timestamp delete_time = 6;

// Expire time of the blob object.
google.protobuf.Timestamp expire_time = 7;

// The ownership of the blob.
// For an example check out ownership.
odpf.assets.facets.Ownership ownership = 31;

// List of the user's custom properties.
// Properties facet can be used to set custom properties, tags and labels for a user.
odpf.assets.facets.Properties properties = 32;

// The timestamp of the blob's creation.
// Timstamp facet can be used to set the creation and updation timestamp of a blob.
odpf.assets.common.Timestamp timestamps = 33;
}
26 changes: 26 additions & 0 deletions odpf/assets/common/event.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
syntax = "proto3";

package odpf.assets.common;

option java_package = "io.odpf.assets.common";
option java_outer_classname = "EventProto";
option go_package = "github.com/odpf/proton/assets/common";

import "google/protobuf/timestamp.proto";

// Event represents an event in the system.
// Event is majorly used to represent the state of the system in the form of events.
// It can be used in any schema which intend to produce events to message bus.
message Event {
// The timestamp of the event.
// Example: `2018-01-01T00:00:00Z`.
google.protobuf.Timestamp timestamp = 1;

// The activity that created the event.
// Example: `create`, `update`.
string action = 2;

// The description of the event.
// Example: `user is created from signup form`.
string description = 3;
}
32 changes: 32 additions & 0 deletions odpf/assets/common/resource.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
syntax = "proto3";

package odpf.assets.common;

option java_package = "io.odpf.assets.common";
option java_outer_classname = "ResourceProto";
option go_package = "github.com/odpf/proton/assets/common";


// Resource is a generic resource that represents a file or other resource.
// It can be a table, job, user or group.
message Resource {
// The unique identifier of the resource.
// Example: `user:jdoe` or `group:accounting`.
string urn = 1;

// The name of the resource.
// Example: `John Doe` or `Accounting`.
string name = 2;

// The source of the resource.
// Example: `github` or `bigquery`.
string service = 3;

// The type of the asset.
// Example: `user` or `group`.
string type = 4;

// The REST URL for accessing the resource. URL returns the resource itself.
// Example: `https://xyz.com/v1/users/user-123`
string url = 5;
}
28 changes: 28 additions & 0 deletions odpf/assets/common/timestamp.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
syntax = "proto3";

package odpf.assets.common;

option java_package = "io.odpf.assets.common";
option java_outer_classname = "TimestampProto";
option go_package = "github.com/odpf/proton/assets/common";

import "google/protobuf/timestamp.proto";

// Timestamp represents created and modified timestamps.
message Timestamp {
// The timestamp when the object was created.
google.protobuf.Timestamp create_time = 1;

// The timestamp when the object was last modified.
google.protobuf.Timestamp update_time = 2;
}

// A time window specified by its `start_time` and `end_time`.
message TimeWindow {
// Start time of the time window (exclusive).
google.protobuf.Timestamp start_time = 1;

// End time of the time window (inclusive). If not specified, the current
// timestamp is used instead.
google.protobuf.Timestamp end_time = 2;
}
109 changes: 109 additions & 0 deletions odpf/assets/dashboard.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
syntax = "proto3";

package odpf.assets;

option java_package = "io.odpf.assets";
option java_outer_classname = "DashboardProto";
option go_package = "github.com/odpf/proton/assets";

import "odpf/assets/facets/ownership.proto";
import "odpf/assets/facets/lineage.proto";
import "odpf/assets/facets/properties.proto";

import "odpf/assets/common/resource.proto";
import "odpf/assets/common/timestamp.proto";
import "odpf/assets/common/event.proto";

// Dashboard is a resource that represents a dashboard.
message Dashboard {
// Representation of the resource
odpf.assets.common.Resource resource = 1;

// The description of the dashboard.
// Example: "This dashboard was created by the Metabase team."
string description = 4;

// The list of the charts in the dashboard.
// For an example, check the schema of the chart.
repeated Chart charts = 21;

// The ownership of the topic.
// For an example check out ownership.
odpf.assets.facets.Ownership ownership = 31;

// List of the user's custom properties.
// Properties facet can be used to set custom properties, tags and labels for a user.
odpf.assets.facets.Properties properties = 32;

// The timestamp of the user's creation.
// Timstamp facet can be used to set the creation and updation timestamp of a user.
odpf.assets.common.Timestamp timestamps = 33;

// The timestamp of the generated event.
// Event schemas is defined in the common event schema.
odpf.assets.common.Event event = 100;

}

message Chart {
// The URN of the chart.
// Example: `chart:1`.
string urn = 1;

// The name of the chart.
// Example: `My Chart`.
string name = 2;

// The type of the chart.
// Example: `line`.
string type = 3;

// The source of the chart.
// Example: `metabase`.
string source = 4;

// The description of the chart.
// Example: `This is a chart for my dashboard.`
string description = 5;

// The url of the chart.
// Example: `http://metabase.com/charts/mychart`.
string url = 6;

// The raw query of the chart.
// Example: `SELECT * FROM my_table`.
string raw_query = 7;

// The source of the data.
// Example: `bigquery,graphite`.
string data_source = 8;

// The dashboard ur of the chart.
// Example: `dashboard:1`.
string dashboard_urn = 9;

// The source of the dashboard of the chart.
// Example: `metabase`.
string dashboard_source = 10;

// The ownership of the dashboard.
// For an example check out ownership.
odpf.assets.facets.Ownership ownership = 31;

// The lineage of the dashboard.
// For an example check out lineage schema.
odpf.assets.facets.Lineage lineage = 32;

// List of the user's custom properties.
// Properties facet can be used to set custom properties, tags and labels for a dashboard.
odpf.assets.facets.Properties properties = 33;

// The timestamp of the user's creation.
// Timstamp facet can be used to set the creation and updation timestamp of a dashboard.
odpf.assets.common.Timestamp timestamps = 34;

// The timestamp of the generated event.
// Event schemas is defined in the common event schema.
odpf.assets.common.Event event = 100;

}
21 changes: 21 additions & 0 deletions odpf/assets/facets/lineage.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
syntax = "proto3";

package odpf.assets.facets;

option java_package = "io.odpf.assets.facets";
option java_outer_classname = "LineageProto";
option go_package = "github.com/odpf/proton/assets/facets";

import "odpf/assets/common/resource.proto";

// Linage reprsents the relationship of resource to other resources.
// Relation is way of describing the relationship between two resources.
message Lineage {
// The resource that is the source of the relationship.
// Example: a resource that is the parent of another resource.
repeated odpf.assets.common.Resource upstreams = 1;

// The resource that is the destination of the relationship.
// Example: a resource that is the child of another resource.
repeated odpf.assets.common.Resource downstreams = 2;
}
31 changes: 31 additions & 0 deletions odpf/assets/facets/ownership.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
syntax = "proto3";

package odpf.assets.facets;

option java_package = "io.odpf.assets.facets";
option java_outer_classname = "OwnershipProto";
option go_package = "github.com/odpf/proton/assets/facets";

import "odpf/assets/common/resource.proto";

// Ownership is a facet that describes the ownership of a resource.
message Ownership {
// Requird: The list of owners of the resource.
// For an example check the owner schema.
repeated Owner owners = 7;
}

// Owner is a facet that describes the owner of a resource.
message Owner {
// The name of the owner.
// Example: `user:johndoe`.

string urn = 1;
// The name of the owner.
// Example: `John Doe`.
string name = 2;

// The role of the owner.
// Example: `admin`, `steward`.
string role = 3;
}
22 changes: 22 additions & 0 deletions odpf/assets/facets/properties.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
syntax = "proto3";

package odpf.assets.facets;

option java_package = "io.odpf.assets.facets";
option java_outer_classname = "PropertiesProto";
option go_package = "github.com/odpf/proton/assets/facets";

import "google/protobuf/struct.proto";

message Properties {

// Optional: List of tags the user has.
repeated string tags = 1;

//Optional. List of labels the user has.
map<string,string> labels = 2;

// Optional: List of properties the user has.
google.protobuf.Struct attributes = 3;

}
Loading