diff --git a/src/main/proto/kessel/inventory/v1beta1/k8s_cluster.proto b/src/main/proto/kessel/inventory/v1beta1/k8s_cluster.proto new file mode 100644 index 0000000..fecaa56 --- /dev/null +++ b/src/main/proto/kessel/inventory/v1beta1/k8s_cluster.proto @@ -0,0 +1,24 @@ +syntax = "proto3"; + +package kessel.inventory.v1beta1.resources; + +import "buf/validate/validate.proto"; + +import "kessel/inventory/v1beta1/resources/k8s_cluster_detail.proto"; +import "kessel/inventory/v1beta1/resources/metadata.proto"; +import "kessel/inventory/v1beta1/resources/reporter_data.proto"; + +option go_package = "github.com/project-kessel/inventory-api/api/kessel/inventory/v1beta1/resources"; +option java_multiple_files = true; +option java_package = "org.project_kessel.api.inventory.v1beta1.resources"; +option java_outer_classname = "K8sClusterProto"; + +message K8sCluster { + // Metadata about this resource + Metadata metadata = 1; + + // Write only reporter specific data + ReporterData reporter_data = 245278792 [ json_name = "reporter_data", (buf.validate.field).required = true ]; + + K8sClusterDetail resource_data = 2122698 [ json_name = "resource_data", (buf.validate.field).required = true ]; +} diff --git a/src/main/proto/kessel/inventory/v1beta1/k8s_cluster_detail.proto b/src/main/proto/kessel/inventory/v1beta1/k8s_cluster_detail.proto new file mode 100644 index 0000000..eea4267 --- /dev/null +++ b/src/main/proto/kessel/inventory/v1beta1/k8s_cluster_detail.proto @@ -0,0 +1,84 @@ +syntax = "proto3"; + +package kessel.inventory.v1beta1.resources; + +import "kessel/inventory/v1beta1/resources/k8s_cluster_detail_nodes_inner.proto"; +import "buf/validate/validate.proto"; + +option go_package = "github.com/project-kessel/inventory-api/api/kessel/inventory/v1beta1/resources"; +option java_multiple_files = true; +option java_package = "org.project_kessel.api.inventory.v1beta1.resources"; +option java_outer_classname = "K8sClusterDetailProto"; + +message K8sClusterDetail { + + // the aggregate status of the cluster + enum ClusterStatus { + CLUSTER_STATUS_UNSPECIFIED = 0; + CLUSTER_STATUS_OTHER = 1; + READY = 2; + FAILED = 3; + OFFLINE = 4; + } + + // The kubernetes vendor + enum KubeVendor { + KUBE_VENDOR_UNSPECIFIED = 0; + KUBE_VENDOR_OTHER = 1; + AKS = 2; + EKS = 3; + IKS = 4; + OPENSHIFT = 5; + GKE = 6; + } + + // The platform on which this cluster is hosted + enum CloudPlatform { + CLOUD_PLATFORM_UNSPECIFIED = 0; + CLOUD_PLATFORM_OTHER = 1; + NONE_UPI = 2; + BAREMETAL_IPI = 3; + BAREMETAL_UPI = 4; + AWS_IPI = 5; + AWS_UPI = 6; + AZURE_IPI = 7; + AZURE_UPI = 8; + IBMCLOUD_IPI = 9; + IBMCLOUD_UPI = 10; + KUBEVIRT_IPI = 11; + OPENSTACK_IPI = 12; + OPENSTACK_UPI = 13; + GCP_IPI = 14; + GCP_UPI = 15; + NUTANIX_IPI = 16; + NUTANIX_UPI = 17; + VSPHERE_IPI = 18; + VSPHERE_UPI = 19; + OVIRT_IPI = 20; + + + } + + // The OCP cluster ID or ARN etc for *KS + string external_cluster_id = 219571597 [ json_name = "external_cluster_id", (buf.validate.field).string.min_len = 1 ]; + + ClusterStatus cluster_status = 499346904 [ json_name = "cluster_status", (buf.validate.field).enum = {not_in: [0], defined_only: true} ]; + + optional string cluster_reason = 499346905 [ json_name = "cluster_reason", + (buf.validate.field).string.min_len = 1, + (buf.validate.field).string.max_len = 1024, + (buf.validate.field).string.pattern = "^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$" + ]; + + // The version of kubernetes + string kube_version = 395858490 [ json_name = "kube_version" ]; + + KubeVendor kube_vendor = 264191642 [ json_name = "kube_vendor", (buf.validate.field).enum = {not_in: [0], defined_only: true} ]; + + // The version of the productized kubernetes distribution + string vendor_version = 23961827 [ json_name = "vendor_version", (buf.validate.field).string.min_len = 1 ]; + + CloudPlatform cloud_platform = 476768062 [ json_name = "cloud_platform", (buf.validate.field).enum = {not_in: [0], defined_only: true} ]; + + repeated K8sClusterDetailNodesInner nodes = 75440785; +} diff --git a/src/main/proto/kessel/inventory/v1beta1/k8s_cluster_detail_nodes_inner.proto b/src/main/proto/kessel/inventory/v1beta1/k8s_cluster_detail_nodes_inner.proto new file mode 100644 index 0000000..ac16c92 --- /dev/null +++ b/src/main/proto/kessel/inventory/v1beta1/k8s_cluster_detail_nodes_inner.proto @@ -0,0 +1,29 @@ +syntax = "proto3"; + +package kessel.inventory.v1beta1.resources; + +import "buf/validate/validate.proto"; + +import "kessel/inventory/v1beta1/resources/resource_label.proto"; + +option go_package = "github.com/project-kessel/inventory-api/api/kessel/inventory/v1beta1/resources"; +option java_multiple_files = true; +option java_package = "org.project_kessel.api.inventory.v1beta1.resources"; +option java_outer_classname = "K8sClusterDetailNodesInnerProto"; + +message K8sClusterDetailNodesInner { + + // The name of the node (this can contain private info) + string name = 3373707 [ (buf.validate.field).string.min_len = 1 ]; + + // CPU Capacity of the node defined in CPU units, e.g. \"0.5\" + string cpu = 98728 [ (buf.validate.field).string.min_len = 1 ]; + + // Memory Capacity of the node defined as MiB, e.g. \"50Mi\" + string memory = 4014849 [ (buf.validate.field).string.min_len = 1 ]; + + // Map of string keys and string values that can be used to organize and + // categorize (scope and select) resources + // Todo: Do we require at least 1 label? + repeated ResourceLabel labels = 36675587 [ (buf.validate.field).repeated.items.required = true ]; +} diff --git a/src/main/proto/kessel/inventory/v1beta1/k8s_clusters_service.proto b/src/main/proto/kessel/inventory/v1beta1/k8s_clusters_service.proto new file mode 100644 index 0000000..477b787 --- /dev/null +++ b/src/main/proto/kessel/inventory/v1beta1/k8s_clusters_service.proto @@ -0,0 +1,61 @@ +syntax = "proto3"; + +package kessel.inventory.v1beta1.resources; + +import "google/api/annotations.proto"; +import "buf/validate/validate.proto"; + +import "kessel/inventory/v1beta1/resources/k8s_cluster.proto"; +import "kessel/inventory/v1beta1/resources/reporter_data.proto"; + +option go_package = "github.com/project-kessel/inventory-api/api/kessel/inventory/v1beta1/resources"; +option java_multiple_files = true; +option java_package = "org.project_kessel.api.inventory.v1beta1.resources"; + +message CreateK8sClusterRequest { + // The k8s cluster to create in Kessel Asset Inventory + K8sCluster k8s_cluster = 1 [ json_name = "k8s_cluster" ]; +} + +message CreateK8sClusterResponse {} + +message UpdateK8sClusterRequest { + // The resource to be updated will be defined by + // \"::\" + // from the request body. + K8sCluster k8s_cluster = 1 [ json_name = "k8s_cluster" ]; +} + +message UpdateK8sClusterResponse {} + +message DeleteK8sClusterRequest { + // The resource to be deleted will be defined by + // \"::\" + // from the request body. + ReporterData reporter_data = 1 [ json_name = "reporter_data", (buf.validate.field).required = true ]; +} + +message DeleteK8sClusterResponse {} + +service KesselK8sClusterService { + rpc CreateK8sCluster(CreateK8sClusterRequest) returns (CreateK8sClusterResponse) { + option (google.api.http) = { + post : "/api/inventory/v1beta1/resources/k8s-clusters" + body : "*" + }; + }; + + rpc UpdateK8sCluster(UpdateK8sClusterRequest) returns (UpdateK8sClusterResponse) { + option (google.api.http) = { + put : "/api/inventory/v1beta1/resources/k8s-clusters" + body : "*" + }; + }; + + rpc DeleteK8sCluster(DeleteK8sClusterRequest) returns (DeleteK8sClusterResponse) { + option (google.api.http) = { + delete : "/api/inventory/v1beta1/resources/k8s-clusters" + body : "*" + }; + }; +} diff --git a/src/main/proto/kessel/inventory/v1beta1/k8s_policies_service.proto b/src/main/proto/kessel/inventory/v1beta1/k8s_policies_service.proto new file mode 100644 index 0000000..dc8a9cc --- /dev/null +++ b/src/main/proto/kessel/inventory/v1beta1/k8s_policies_service.proto @@ -0,0 +1,61 @@ +syntax = "proto3"; + +package kessel.inventory.v1beta1.resources; + +import "google/api/annotations.proto"; +import "buf/validate/validate.proto"; + +import "kessel/inventory/v1beta1/resources/k8s_policy.proto"; +import "kessel/inventory/v1beta1/resources/reporter_data.proto"; + +option go_package = "github.com/project-kessel/inventory-api/api/kessel/inventory/v1beta1/resources"; +option java_multiple_files = true; +option java_package = "org.project_kessel.api.inventory.v1beta1.resources"; + +message CreateK8sPolicyRequest { + // The policy to create in Kessel Asset Inventory + K8sPolicy k8s_policy = 1 [ json_name = "k8s_policy", (buf.validate.field).required = true ]; +} + +message CreateK8sPolicyResponse {} + +message UpdateK8sPolicyRequest { + // The resource to be updated will be defined by + // \"::\" + // from the request body. + K8sPolicy k8s_policy = 1 [ json_name = "k8s_policy", (buf.validate.field).required = true ]; +} + +message UpdateK8sPolicyResponse {} + +message DeleteK8sPolicyRequest { + // The resource to be deleted will be defined by + // \"::\" + // from the request body. + ReporterData reporter_data = 1 [ json_name = "reporter_data", (buf.validate.field).required = true ]; +} + +message DeleteK8sPolicyResponse {} + +service KesselK8sPolicyService { + rpc CreateK8sPolicy(CreateK8sPolicyRequest) returns (CreateK8sPolicyResponse) { + option (google.api.http) = { + post : "/api/inventory/v1beta1/resources/k8s-policies" + body : "*" + }; + }; + + rpc UpdateK8sPolicy(UpdateK8sPolicyRequest) returns (UpdateK8sPolicyResponse) { + option (google.api.http) = { + put : "/api/inventory/v1beta1/resources/k8s-policies" + body : "*" + }; + }; + + rpc DeleteK8sPolicy(DeleteK8sPolicyRequest) returns (DeleteK8sPolicyResponse) { + option (google.api.http) = { + delete : "/api/inventory/v1beta1/resources/k8s-policies" + body : "*" + }; + }; +} diff --git a/src/main/proto/kessel/inventory/v1beta1/k8s_policy.proto b/src/main/proto/kessel/inventory/v1beta1/k8s_policy.proto new file mode 100644 index 0000000..4241753 --- /dev/null +++ b/src/main/proto/kessel/inventory/v1beta1/k8s_policy.proto @@ -0,0 +1,24 @@ +syntax = "proto3"; + +package kessel.inventory.v1beta1.resources; + +import "buf/validate/validate.proto"; + +import "kessel/inventory/v1beta1/resources/metadata.proto"; +import "kessel/inventory/v1beta1/resources/k8s_policy_detail.proto"; +import "kessel/inventory/v1beta1/resources/reporter_data.proto"; + +option go_package = "github.com/project-kessel/inventory-api/api/kessel/inventory/v1beta1/resources"; +option java_multiple_files = true; +option java_package = "org.project_kessel.api.inventory.v1beta1.resources"; +option java_outer_classname = "K8sPolicyProto"; + +message K8sPolicy { + // Metadata about this resource + Metadata metadata = 1; + + // Write only reporter specific data + ReporterData reporter_data = 245278792 [ json_name = "reporter_data", (buf.validate.field).required = true ]; + + K8sPolicyDetail resource_data = 2122698 [ json_name = "resource_data", (buf.validate.field).required = true ]; +} diff --git a/src/main/proto/kessel/inventory/v1beta1/k8s_policy_detail.proto b/src/main/proto/kessel/inventory/v1beta1/k8s_policy_detail.proto new file mode 100644 index 0000000..7a6b31a --- /dev/null +++ b/src/main/proto/kessel/inventory/v1beta1/k8s_policy_detail.proto @@ -0,0 +1,28 @@ +syntax = "proto3"; + +package kessel.inventory.v1beta1.resources; + +import "buf/validate/validate.proto"; + +option go_package = "github.com/project-kessel/inventory-api/api/kessel/inventory/v1beta1/resources"; +option java_multiple_files = true; +option java_package = "org.project_kessel.api.inventory.v1beta1.resources"; +option java_outer_classname = "K8sPolicyDetailProto"; + +message K8sPolicyDetail { + + // The kind of policy + enum Severity { + SEVERITY_UNSPECIFIED = 0; + SEVERITY_OTHER = 1; + LOW = 2; + MEDIUM = 3; + HIGH = 4; + CRITICAL = 5; + } + + // Defines if the policy is currently enabled or disabled across all targets + bool disabled = 270940797; + + Severity severity = 404558592 [ (buf.validate.field).enum.defined_only = true ]; +} diff --git a/src/main/proto/kessel/inventory/v1beta1/k8spolicy_ispropagatedto_k8scluster.proto b/src/main/proto/kessel/inventory/v1beta1/k8spolicy_ispropagatedto_k8scluster.proto new file mode 100644 index 0000000..412ca11 --- /dev/null +++ b/src/main/proto/kessel/inventory/v1beta1/k8spolicy_ispropagatedto_k8scluster.proto @@ -0,0 +1,24 @@ +syntax = "proto3"; + +package kessel.inventory.v1beta1.relationships; + +import "kessel/inventory/v1beta1/relationships/metadata.proto"; +import "kessel/inventory/v1beta1/relationships/reporter_data.proto"; +import "kessel/inventory/v1beta1/relationships/k8spolicy_ispropagatedto_k8scluster_detail.proto"; +import "buf/validate/validate.proto"; + +option go_package = "github.com/project-kessel/inventory-api/api/kessel/inventory/v1beta1/relationships"; +option java_multiple_files = true; +option java_package = "org.project_kessel.api.inventory.v1beta1.relationships"; +option java_outer_classname = "K8SPolicyIsPropagatedToK8SClusterProto"; + +message K8SPolicyIsPropagatedToK8SCluster { + + // Metadata about this resource + Metadata metadata = 1 [ (buf.validate.field) = {required: false, ignore: IGNORE_ALWAYS} ]; + + // Write only reporter specific data + ReporterData reporter_data = 245278793 [ json_name = "reporter_data", (buf.validate.field).required = true ]; + + K8SPolicyIsPropagatedToK8SClusterDetail relationship_data = 2122699 [ json_name = "relationship_data", (buf.validate.field).required = true ]; +} diff --git a/src/main/proto/kessel/inventory/v1beta1/k8spolicy_ispropagatedto_k8scluster_detail.proto b/src/main/proto/kessel/inventory/v1beta1/k8spolicy_ispropagatedto_k8scluster_detail.proto new file mode 100644 index 0000000..c1134e8 --- /dev/null +++ b/src/main/proto/kessel/inventory/v1beta1/k8spolicy_ispropagatedto_k8scluster_detail.proto @@ -0,0 +1,30 @@ +syntax = "proto3"; + +package kessel.inventory.v1beta1.relationships; + +import "google/api/field_behavior.proto"; +import "buf/validate/validate.proto"; + +option go_package = "github.com/project-kessel/inventory-api/api/kessel/inventory/v1beta1/relationships"; +option java_multiple_files = true; +option java_package = "org.project_kessel.api.inventory.v1beta1.relationships"; +option java_outer_classname = "K8SPolicyIsPropagatedToK8SClusterDetailProto"; + +message K8SPolicyIsPropagatedToK8SClusterDetail { + + // the aggregate status of the cluster + enum Status { + STATUS_UNSPECIFIED = 0; + STATUS_OTHER = 1; + VIOLATIONS = 2; + NO_VIOLATIONS = 3; + } + + // The resource ID assigned to the resource by Kessel Asset Inventory. + int64 k8s_policy_id = 225679544 [ json_name = "k8s_policy_id", (google.api.field_behavior) = OUTPUT_ONLY ]; + + // The resource ID assigned to the resource by Kessel Asset Inventory. + int64 k8s_cluster_id = 240280960 [ json_name = "k8s_cluster_id", (google.api.field_behavior) = OUTPUT_ONLY ]; + + Status status = 355610639 [ json_name = "status",(buf.validate.field).enum = {not_in: [0], defined_only: true} ]; +} diff --git a/src/main/proto/kessel/inventory/v1beta1/k8spolicy_ispropagatedto_k8scluster_service.proto b/src/main/proto/kessel/inventory/v1beta1/k8spolicy_ispropagatedto_k8scluster_service.proto new file mode 100644 index 0000000..b747962 --- /dev/null +++ b/src/main/proto/kessel/inventory/v1beta1/k8spolicy_ispropagatedto_k8scluster_service.proto @@ -0,0 +1,63 @@ +syntax = "proto3"; + +package kessel.inventory.v1beta1.relationships; + +import "google/api/annotations.proto"; +import "buf/validate/validate.proto"; + +import "kessel/inventory/v1beta1/relationships/k8spolicy_ispropagatedto_k8scluster.proto"; +import "kessel/inventory/v1beta1/relationships/reporter_data.proto"; + +option go_package = "github.com/project-kessel/inventory-api/api/kessel/inventory/v1beta1/relationships"; +option java_multiple_files = true; +option java_package = "org.project_kessel.api.inventory.v1beta1.relationships"; + +message CreateK8SPolicyIsPropagatedToK8SClusterRequest { + // The resource relationship to create in Kessel Asset Inventory + K8SPolicyIsPropagatedToK8SCluster k8spolicy_ispropagatedto_k8scluster = 1 [ json_name = "k8s-policy_is-propagated-to_k8s-cluster", (buf.validate.field).required = true ]; +} + +message CreateK8SPolicyIsPropagatedToK8SClusterResponse {} + +message UpdateK8SPolicyIsPropagatedToK8SClusterRequest { + // The resource-relationship to be updated will be defined by + // \"::\" + // AND \"::\" + // from the request body. + K8SPolicyIsPropagatedToK8SCluster k8spolicy_ispropagatedto_k8scluster = 1 [ json_name = "k8s-policy_is-propagated-to_k8s-cluster", (buf.validate.field).required = true ]; +} + +message UpdateK8SPolicyIsPropagatedToK8SClusterResponse {} + +message DeleteK8SPolicyIsPropagatedToK8SClusterRequest { + // The resource-relationship to be deleted will be defined by + // \"::\" + // AND \"::\" + // from the request body. + ReporterData reporter_data = 1 [ json_name = "reporter_data", (buf.validate.field).required = true ]; +} + +message DeleteK8SPolicyIsPropagatedToK8SClusterResponse {} + +service KesselK8SPolicyIsPropagatedToK8SClusterService { + rpc CreateK8SPolicyIsPropagatedToK8SCluster (CreateK8SPolicyIsPropagatedToK8SClusterRequest) returns (CreateK8SPolicyIsPropagatedToK8SClusterResponse) { + option (google.api.http) = { + post : "/api/inventory/v1beta1/resource-relationships/k8s-policy_is-propagated-to_k8s-cluster" + body : "*" + }; + }; + + rpc UpdateK8SPolicyIsPropagatedToK8SCluster(UpdateK8SPolicyIsPropagatedToK8SClusterRequest) returns (UpdateK8SPolicyIsPropagatedToK8SClusterResponse) { + option (google.api.http) = { + put: "/api/inventory/v1beta1/resource-relationships/k8s-policy_is-propagated-to_k8s-cluster" + body : "*" + }; + }; + + rpc DeleteK8SPolicyIsPropagatedToK8SCluster(DeleteK8SPolicyIsPropagatedToK8SClusterRequest) returns (DeleteK8SPolicyIsPropagatedToK8SClusterResponse) { + option (google.api.http) = { + delete: "/api/inventory/v1beta1/resource-relationships/k8s-policy_is-propagated-to_k8s-cluster" + body : "*" + }; + }; +} diff --git a/src/main/proto/kessel/inventory/v1beta1/metadata.proto b/src/main/proto/kessel/inventory/v1beta1/metadata.proto new file mode 100644 index 0000000..5f5d911 --- /dev/null +++ b/src/main/proto/kessel/inventory/v1beta1/metadata.proto @@ -0,0 +1,43 @@ +syntax = "proto3"; + +package kessel.inventory.v1beta1.resources; + +import "google/api/field_behavior.proto"; +import "google/protobuf/timestamp.proto"; + +import "kessel/inventory/v1beta1/resources/resource_label.proto"; + +option go_package = "github.com/project-kessel/inventory-api/api/kessel/inventory/v1beta1/resources"; +option java_multiple_files = true; +option java_package = "org.project_kessel.api.inventory.v1beta1.resources"; + +message Metadata { + // Kessel Asset Inventory generated identifier. + string id = 3355 [ (google.api.field_behavior) = OUTPUT_ONLY ]; + + // The type of the Resource + string resource_type = 442752204 + [ json_name = "resource_type", (google.api.field_behavior) = OUTPUT_ONLY ]; + + // Date and time when the inventory item was first reported. + google.protobuf.Timestamp created_at = 3400 + [ json_name = "created_at", (google.api.field_behavior) = OUTPUT_ONLY ]; + + // Date and time when the inventory item was last updated. + google.protobuf.Timestamp updated_at = 3401 + [ json_name = "updated_at", (google.api.field_behavior) = OUTPUT_ONLY ]; + + // Date and time when the inventory item was deleted. + google.protobuf.Timestamp deleted_at = 3402 + [ json_name = "deleted_at", (google.api.field_behavior) = OUTPUT_ONLY ]; + + // The org id in which this resource is a member for access control. A + // resource can only be a member of one org. + string org_id = 3500 [ json_name = "org_id" ]; + + // The workspace id in which this resource is a member for access control. A + // resource can only be a member of one workspace. + string workspace_id = 3501 [ json_name = "workspace_id" ]; + + repeated ResourceLabel labels = 3552281; +} diff --git a/src/main/proto/kessel/inventory/v1beta1/notifications_integration.proto b/src/main/proto/kessel/inventory/v1beta1/notifications_integration.proto new file mode 100644 index 0000000..137c40d --- /dev/null +++ b/src/main/proto/kessel/inventory/v1beta1/notifications_integration.proto @@ -0,0 +1,22 @@ +syntax = "proto3"; + +package kessel.inventory.v1beta1.resources; + +import "google/api/field_behavior.proto"; +import "buf/validate/validate.proto"; + +import "kessel/inventory/v1beta1/resources/metadata.proto"; +import "kessel/inventory/v1beta1/resources/reporter_data.proto"; + +option go_package = "github.com/project-kessel/inventory-api/api/kessel/inventory/v1beta1/resources"; +option java_multiple_files = true; +option java_package = "org.project_kessel.api.inventory.v1beta1.resources"; + +message NotificationsIntegration { + // Metadata about this resource + Metadata metadata = 1; + + // Write only reporter specific data + ReporterData reporter_data = 245278792 + [ json_name = "reporter_data", (google.api.field_behavior) = INPUT_ONLY, (buf.validate.field).required = true ]; +} diff --git a/src/main/proto/kessel/inventory/v1beta1/notifications_integrations_service.proto b/src/main/proto/kessel/inventory/v1beta1/notifications_integrations_service.proto new file mode 100644 index 0000000..e0f357e --- /dev/null +++ b/src/main/proto/kessel/inventory/v1beta1/notifications_integrations_service.proto @@ -0,0 +1,61 @@ +syntax = "proto3"; + +package kessel.inventory.v1beta1.resources; + +import "google/api/annotations.proto"; +import "buf/validate/validate.proto"; + +import "kessel/inventory/v1beta1/resources/notifications_integration.proto"; +import "kessel/inventory/v1beta1/resources/reporter_data.proto"; + +option go_package = "github.com/project-kessel/inventory-api/api/kessel/inventory/v1beta1/resources"; +option java_multiple_files = true; +option java_package = "org.project_kessel.api.inventory.v1beta1.resources"; + +message CreateNotificationsIntegrationRequest { + // The NotificationsIntegration to create in Kessel Asset Inventory + NotificationsIntegration integration = 1 [ (buf.validate.field).required = true ]; +} + +message CreateNotificationsIntegrationResponse {} + +message UpdateNotificationsIntegrationRequest { + // The resource to be updated will be defined by + // \"::\" + // from the request body. + NotificationsIntegration integration = 1 [ (buf.validate.field).required = true ]; +} + +message UpdateNotificationsIntegrationResponse {} + +message DeleteNotificationsIntegrationRequest { + // The resource to be deleted will be defined by + // \"::\" + // from the request body. + ReporterData reporter_data = 1 [ json_name = "reporter_data", (buf.validate.field).required = true ]; +} + +message DeleteNotificationsIntegrationResponse {} + +service KesselNotificationsIntegrationService { + rpc CreateNotificationsIntegration(CreateNotificationsIntegrationRequest) returns (CreateNotificationsIntegrationResponse) { + option (google.api.http) = { + post : "/api/inventory/v1beta1/resources/notifications-integrations" + body : "*" + }; + }; + + rpc UpdateNotificationsIntegration(UpdateNotificationsIntegrationRequest) returns (UpdateNotificationsIntegrationResponse) { + option (google.api.http) = { + put : "/api/inventory/v1beta1/resources/notifications-integrations" + body : "*" + }; + }; + + rpc DeleteNotificationsIntegration(DeleteNotificationsIntegrationRequest) returns (DeleteNotificationsIntegrationResponse) { + option (google.api.http) = { + delete : "/api/inventory/v1beta1/resources/notifications-integrations" + body : "*" + }; + }; +} diff --git a/src/main/proto/kessel/inventory/v1beta1/reporter_data.proto b/src/main/proto/kessel/inventory/v1beta1/reporter_data.proto new file mode 100644 index 0000000..d6cfc03 --- /dev/null +++ b/src/main/proto/kessel/inventory/v1beta1/reporter_data.proto @@ -0,0 +1,44 @@ +syntax = "proto3"; + +package kessel.inventory.v1beta1.resources; + +import "google/api/field_behavior.proto"; +import "buf/validate/validate.proto"; + +option go_package = "github.com/project-kessel/inventory-api/api/kessel/inventory/v1beta1/resources"; +option java_multiple_files = true; +option java_package = "org.project_kessel.api.inventory.v1beta1.resources"; + +message ReporterData { + + enum ReporterType { + REPORTER_TYPE_UNSPECIFIED = 0; + REPORTER_TYPE_OTHER = 1; + ACM = 2; + HBI = 3; + OCM = 4; + NOTIFICATIONS = 5; + } + + ReporterType reporter_type = 245778392 [ json_name = "reporter_type", (buf.validate.field).enum = {not_in: [0], defined_only: true} ]; + + // The ID of the instance of the reporter. This is derived from the + // authentication mechanism, i.e. authentication token. + string reporter_instance_id = 241085112 + [ json_name = "reporter_instance_id", (google.api.field_behavior) = OUTPUT_ONLY ]; + + // The URL for this resource in the reporter's management UI console. For + // example this would be the cluster URL in the HCC Console for an OCM + // reported cluster. + string console_href = 145854740 [ json_name = "console_href" ]; + + // Reporter specific API link to the resource. + string api_href = 430210609 [ json_name = "api_href" ]; + + // The ID assigned to this resource by the reporter, for example OCM cluster + // ID, HBI's host id, or ACM managed cluster name etc. + string local_resource_id = 508976189 [ json_name = "local_resource_id", (buf.validate.field).string.min_len = 1 ]; + + // version of the reporter + string reporter_version = 269629306 [ json_name = "reporter_version" ]; +} diff --git a/src/main/proto/kessel/inventory/v1beta1/resource_label.proto b/src/main/proto/kessel/inventory/v1beta1/resource_label.proto new file mode 100644 index 0000000..6a46595 --- /dev/null +++ b/src/main/proto/kessel/inventory/v1beta1/resource_label.proto @@ -0,0 +1,16 @@ +syntax = "proto3"; + +package kessel.inventory.v1beta1.resources; + +import "buf/validate/validate.proto"; + +option go_package = "github.com/project-kessel/inventory-api/api/kessel/inventory/v1beta1/resources"; +option java_multiple_files = true; +option java_package = "org.project_kessel.api.inventory.v1beta1.resources"; + +message ResourceLabel { + + string key = 106079 [ (buf.validate.field).string.min_len = 1 ]; + + string value = 111972721 [ (buf.validate.field).string.min_len = 1 ]; +} diff --git a/src/main/proto/kessel/inventory/v1beta1/rhel_host.proto b/src/main/proto/kessel/inventory/v1beta1/rhel_host.proto new file mode 100644 index 0000000..4333812 --- /dev/null +++ b/src/main/proto/kessel/inventory/v1beta1/rhel_host.proto @@ -0,0 +1,22 @@ +syntax = "proto3"; + +package kessel.inventory.v1beta1.resources; + +import "google/api/field_behavior.proto"; +import "buf/validate/validate.proto"; + +import "kessel/inventory/v1beta1/resources/metadata.proto"; +import "kessel/inventory/v1beta1/resources/reporter_data.proto"; + +option go_package = "github.com/project-kessel/inventory-api/api/kessel/inventory/v1beta1/resources"; +option java_multiple_files = true; +option java_package = "org.project_kessel.api.inventory.v1beta1.resources"; + +message RhelHost { + // Metadata about this resource + Metadata metadata = 1 [ (buf.validate.field) = {required: false, ignore: IGNORE_ALWAYS} ]; + + // Write only reporter specific data + ReporterData reporter_data = 245278792 + [ json_name = "reporter_data", (google.api.field_behavior) = INPUT_ONLY, (buf.validate.field).required = true ]; +} diff --git a/src/main/proto/kessel/inventory/v1beta1/rhel_hosts_service.proto b/src/main/proto/kessel/inventory/v1beta1/rhel_hosts_service.proto new file mode 100644 index 0000000..bf4b787 --- /dev/null +++ b/src/main/proto/kessel/inventory/v1beta1/rhel_hosts_service.proto @@ -0,0 +1,61 @@ +syntax = "proto3"; + +package kessel.inventory.v1beta1.resources; + +import "google/api/annotations.proto"; +import "buf/validate/validate.proto"; + +import "kessel/inventory/v1beta1/resources/rhel_host.proto"; +import "kessel/inventory/v1beta1/resources/reporter_data.proto"; + +option go_package = "github.com/project-kessel/inventory-api/api/kessel/inventory/v1beta1/resources"; +option java_multiple_files = true; +option java_package = "org.project_kessel.api.inventory.v1beta1.resources"; + +message CreateRhelHostRequest { + // The Rhel Host to create in Kessel Asset Inventory + RhelHost rhel_host = 1 [ json_name = "rhel_host", (buf.validate.field).required = true ]; +} + +message CreateRhelHostResponse {} + +message UpdateRhelHostRequest { + // The resource to be updated will be defined by + // \"::\" + // from the request body. + RhelHost rhel_host = 1 [ json_name = "rhel_host", (buf.validate.field).required = true ]; +} + +message UpdateRhelHostResponse {} + +message DeleteRhelHostRequest { + // The resource to be updated will be defined by + // \"::\" + // from the request body. + ReporterData reporter_data = 1 [ json_name = "reporter_data", (buf.validate.field).required = true ]; +} + +message DeleteRhelHostResponse {} + +service KesselRhelHostService { + rpc CreateRhelHost(CreateRhelHostRequest) returns (CreateRhelHostResponse) { + option (google.api.http) = { + post : "/api/inventory/v1beta1/resources/rhel-hosts" + body : "*" + }; + }; + + rpc UpdateRhelHost(UpdateRhelHostRequest) returns (UpdateRhelHostResponse) { + option (google.api.http) = { + put : "/api/inventory/v1beta1/resources/rhel-hosts" + body : "*" + }; + }; + + rpc DeleteRhelHost(DeleteRhelHostRequest) returns (DeleteRhelHostResponse) { + option (google.api.http) = { + delete : "/api/inventory/v1beta1/resources/rhel-hosts" + body : "*" + }; + }; +}