Skip to content

Commit

Permalink
feat: update entities schema
Browse files Browse the repository at this point in the history
  • Loading branch information
ravisuhag committed Aug 15, 2021
1 parent 48eedb3 commit 5f2f7b2
Show file tree
Hide file tree
Showing 33 changed files with 653 additions and 385 deletions.
28 changes: 28 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>proton</name>
<comment>Project proton created by Buildship.</comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
</natures>
<filteredResources>
<filter>
<id>1625977453235</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>
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.1/libexec/openjdk.jdk/Contents/Home
jvm.arguments=
offline.mode=false
override.workspace.settings=true
show.console.view=true
show.executions.view=true
25 changes: 25 additions & 0 deletions odpf/entities/common/event.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
syntax = "proto3";

package odpf.entities.common;

option java_package = "io.odpf.entities.common";
option java_outer_classname = "Event";
option go_package = "github.com/odpf/proton/entities/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 {
// Required. The timestamp of the event.
// For example "2018-01-01T00:00:00Z".
google.protobuf.Timestamp timestamp = 1;
// Optional. The activity that created the event.
// For example "create", "update".
string action = 2;
// Optional. The description of the event.
// For example "user is created from signup form".
string description = 3;

}
25 changes: 25 additions & 0 deletions odpf/entities/common/resource.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
syntax = "proto3";

package odpf.entities.common;

option java_package = "io.odpf.entities.common";
option java_outer_classname = "Resource";
option go_package = "github.com/odpf/proton/entities/common";


// Resource is a generic resource that represents a file or other resource.
// It can be a data asset, job, user or group.
message Resource {
// Required. The unique identifier of the resource.
// For example. "user:jdoe" or "group:accounting".
string urn = 1;
// Required. The name of the resource.
// For example. "John Doe" or "Accounting".
string name = 2;
// Required. The source of the resource.
// For example. "github" or "bigquery".
string source = 3;
// Required. The type of the resource.
// For example. "user" or "group".
string type = 4;
}
17 changes: 17 additions & 0 deletions odpf/entities/common/timestamp.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
syntax = "proto3";

package odpf.entities.common;

option java_package = "io.odpf.entities.common";
option java_outer_classname = "Timestamp";
option go_package = "github.com/odpf/proton/entities/common";

import "google/protobuf/timestamp.proto";

// Timestamp represents created and modified timestamps.
message Timestamp {
// Created is the timestamp when the object was created.
google.protobuf.Timestamp created_at = 1;
// Updated is the timestamp when the object was last modified.
google.protobuf.Timestamp updated_at = 2;
}
34 changes: 34 additions & 0 deletions odpf/entities/facets/columns.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
syntax = "proto3";

package odpf.entities.facets;

option java_package = "io.odpf.entities.facets";
option java_outer_classname = "Columns";
option go_package = "github.com/odpf/proton/entities/facets";


// Columns represents a list of columns.
// It is facet used to specify the schema of a table or a file.
message Columns {
// The list of columns.
repeated Column columns = 1;
}

// Column represents a column in a table or a file.
message Column {
// Required. The name of the column.
// For example, "customer_id".
string name = 1;
// Optional. The description of the column.
// For example, "The unique id of the customer"
string description = 2;
// Required. The data type of the column.
// For example, "INT64".
string data_type = 3;
// Optional. The format of the column.
// For example, "true".
bool is_nullable = 4;
// Optional. The length of the column.
// For example, "10".
int64 length = 5;
}
20 changes: 20 additions & 0 deletions odpf/entities/facets/lineage.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
syntax = "proto3";

package odpf.entities.facets;

option java_package = "io.odpf.entities.facets";
option java_outer_classname = "Lineage";
option go_package = "github.com/odpf/proton/entities/facets";

import "odpf/entities/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.
// For example, a resource that is the parent of another resource.
repeated odpf.entity.common.Resource upstreams = 1;
// The resource that is the destination of the relationship.
// For example, a resource that is the child of another resource.
repeated odpf.entity.common.Resource downstreams = 2;
}
29 changes: 29 additions & 0 deletions odpf/entities/facets/ownership.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
syntax = "proto3";

package odpf.entities.facets;

option java_package = "io.odpf.entities.facets";
option java_outer_classname = "Ownership";
option go_package = "github.com/odpf/proton/entities/facets";

import "odpf/entities/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 {
// Required: The name of the owner.
// For example: "user:johndoe".
string urn = 1;
// Optional: The name of the owner.
// For example: "John Doe".
string name = 2;
// Optional: The role of the owner.
// For example: "admin", "steward".
string role = 3;
}
22 changes: 22 additions & 0 deletions odpf/entities/facets/properties.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
syntax = "proto3";

package odpf.entities.facets;

option java_package = "io.odpf.entities.facets";
option java_outer_classname = "Properties";
option go_package = "github.com/odpf/proton/entities/facets";

import "odpf/entities/common/resource.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.
map<string,string> fields = 3;

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

package odpf.entities.facets;

option java_package = "io.odpf.entities.facets";
option java_outer_classname = "Schema";
option go_package = "github.com/odpf/proton/entities/facets";


message TopicSchema {
string schema_url = 1;
string format = 2;
}
95 changes: 95 additions & 0 deletions odpf/entities/resources/dashboard.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
syntax = "proto3";

package odpf.entities.resources;

option java_package = "io.odpf.entities.resources";
option java_outer_classname = "Dashboard";
option go_package = "github.com/odpf/proton/entities/resources";

import "odpf/entities/facets/schema.proto";
import "odpf/entities/facets/ownership.proto";
import "odpf/entities/facets/lineage.proto";
import "odpf/entities/facets/properties.proto";

import "odpf/entities/common/timestamp.proto";
import "odpf/entities/common/event.proto";


message Dashboard {
// Required. The unique identifier for the dashboard.
// For example, "dashboard-1".
string urn = 1;
// Optional. The name of the dashboard.
// For example, "Dashboard 1".
string name = 2;
// Required. The source of the dashboard.
// For example, "metabase".
string source = 3;
// Optional. The description of the dashboard.
// For example, "This dashboard was created by the Metabase team."
string description = 4;
// Required. The url of the dashboard.
// For example, "https://metabase.com/dashboard/dashboard-1".
string url = 5;
// Optional. The list of the charts in the dashboard.
// For an example, check the schema of the chart.
Chart charts = 21;
// Optional. The ownership of the topic.
// For an example check out ownership.
odpf.entities.facets.Ownership ownership = 31;
odpf.entities.facets.Properties properties = 32;
// Optional. The timestamp of the user's creation.
// Timstamp facet can be used to set the creation and updation timestamp of a user.
// Timestamps are defined in the timestamp schema.
odpf.entities.common.Timestamp timestamps = 33;
// Optional. The timestamp of the generated event.
// Event schemas is defined in the common event schema.
odpf.entities.common.Event event = 100;
}

message Chart {
// Required. The URN of the chart.
// For example, chart:1.
string urn = 1;
// Required. The name of the chart.
// For example, "My Chart".
string name = 2;
// Optional. The type of the chart.
// For example, "line".
string type = 3;
// Optional. The source of the chart.
// For example, "metabase".
string source = 4;
// Optional. The description of the chart.
// For example, "This is a chart for my dashboard."
string description = 5;
// Optional. The url of the chart.
// For example, "http://metabase.com/charts/mychart".
string url = 6;
// Optional. The raw query of the chart.
// For example, "SELECT * FROM my_table".
string raw_query = 7;
// Optional. The dashboard ur of the chart.
// For example, "dashboard:1".
string dashboard_urn = 8;
// Optional. The source of the dashboard of the chart.
// For example, "metabase".
string dashboard_source = 9;
// Optional. The ownership of the topic.
// For an example check out ownership.
odpf.entities.facets.Ownership ownership = 31;
// Optional. The lineage of the topic.
// For an example check out lineage schema.
odpf.entities.facets.Lineage lineage = 32;
// Optional. List of the user's custom properties.
// Properties facet can be used to set custom properties, tags and labels for a user.
// Properties are defined in the properties schema.
odpf.entities.facets.Properties properties = 33;
// Optional. The timestamp of the user's creation.
// Timstamp facet can be used to set the creation and updation timestamp of a user.
// Timestamps are defined in the timestamp schema.
odpf.entities.common.Timestamp timestamps = 34;
// Optional. The timestamp of the generated event.
// Event schemas is defined in the common event schema.
odpf.entities.common.Event event = 100;
}
53 changes: 53 additions & 0 deletions odpf/entities/resources/group.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
syntax = "proto3";

package odpf.entities.resources;

option java_package = "io.odpf.entities.resources";
option java_outer_classname = "Group";
option go_package = "github.com/odpf/proton/entities/resources";


import "odpf/entities/common/timestamp.proto";
import "odpf/entities/common/event.proto";

import "odpf/entities/facets/properties.proto";

// Group represents a group of users and resources.
message Group {
// Required. The unique identifier for the group.
// For example, "group:example".
string urn = 1;
// Optional. The name of the group.
// For example, "Example Group".
string name = 2;
// Optional. The email of the group.
// For example, "xyz@xyz.com"
string email = 3;
// Optional. Source of the group.
// For example, "example.com".
string source = 4;
// Required. The members of the group.
// For example look at schema of the member.
repeated Member members = 21;
// Optional. List of the user's custom properties.
// Properties facet can be used to set custom properties, tags and labels for a user.
// Properties are defined in the properties schema.
odpf.entities.facets.Properties properties = 31;
// Optional. The timestamp of the user's creation.
// Timstamp facet can be used to set the creation and updation timestamp of a user.
// Timestamps are defined in the timestamp schema.
odpf.entities.common.Timestamp timestamps = 32;
// Optional. The timestamp of the generated event.
// Event schemas is defined in the common event schema.
odpf.entities.common.Event event = 100;
}

// Member represents a user.
message Member {
// Required. The unique identifier for the user.
// For example, "user:example".
string urn = 1;
// Optional. The role of the user.
// For example, "owner".
string role = 2;
}
Loading

0 comments on commit 5f2f7b2

Please sign in to comment.