From 43bf92c1c76d8e64297c74038a0816606c7baad0 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 23 Sep 2024 18:46:17 +0530 Subject: [PATCH] Sync updated proto files (#6) Co-authored-by: akoserwal <1783060+akoserwal@users.noreply.github.com> --- .../inventory/v1beta1/k8s_cluster.proto | 26 +++--- .../v1beta1/k8s_cluster_detail.proto | 81 ++++++++++--------- .../k8s_cluster_detail_nodes_inner.proto | 19 +++-- .../v1beta1/k8s_clusters_service.proto | 40 ++++----- .../v1beta1/k8s_policies_service.proto | 61 ++++++++++++++ .../kessel/inventory/v1beta1/k8s_policy.proto | 23 ++++++ .../inventory/v1beta1/k8s_policy_detail.proto | 27 +++++++ .../k8spolicy_ispropagatedto_k8scluster.proto | 23 ++++++ ...icy_ispropagatedto_k8scluster_detail.proto | 29 +++++++ ...cy_ispropagatedto_k8scluster_service.proto | 63 +++++++++++++++ .../kessel/inventory/v1beta1/metadata.proto | 18 ++--- .../v1beta1/notifications_integration.proto | 21 ++--- .../notifications_integrations_service.proto | 51 +++++------- .../inventory/v1beta1/reporter_data.proto | 32 ++++---- .../inventory/v1beta1/resource_label.proto | 12 +-- .../kessel/inventory/v1beta1/rhel_host.proto | 21 ++--- .../v1beta1/rhel_hosts_service.proto | 51 +++++------- 17 files changed, 399 insertions(+), 199 deletions(-) create mode 100644 src/main/proto/kessel/inventory/v1beta1/k8s_policies_service.proto create mode 100644 src/main/proto/kessel/inventory/v1beta1/k8s_policy.proto create mode 100644 src/main/proto/kessel/inventory/v1beta1/k8s_policy_detail.proto create mode 100644 src/main/proto/kessel/inventory/v1beta1/k8spolicy_ispropagatedto_k8scluster.proto create mode 100644 src/main/proto/kessel/inventory/v1beta1/k8spolicy_ispropagatedto_k8scluster_detail.proto create mode 100644 src/main/proto/kessel/inventory/v1beta1/k8spolicy_ispropagatedto_k8scluster_service.proto diff --git a/src/main/proto/kessel/inventory/v1beta1/k8s_cluster.proto b/src/main/proto/kessel/inventory/v1beta1/k8s_cluster.proto index 319ec1c..fecaa56 100644 --- a/src/main/proto/kessel/inventory/v1beta1/k8s_cluster.proto +++ b/src/main/proto/kessel/inventory/v1beta1/k8s_cluster.proto @@ -1,30 +1,24 @@ syntax = "proto3"; -package kessel.inventory.v1beta1; +package kessel.inventory.v1beta1.resources; -import "google/api/field_behavior.proto"; +import "buf/validate/validate.proto"; -import "kessel/inventory/v1beta1/k8s_cluster_detail.proto"; -import "kessel/inventory/v1beta1/metadata.proto"; -import "kessel/inventory/v1beta1/reporter_data.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"; +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"; +option java_package = "org.project_kessel.api.inventory.v1beta1.resources"; option java_outer_classname = "K8sClusterProto"; message K8sCluster { // Metadata about this resource - Metadata metadata = 1 [ (google.api.field_behavior) = REQUIRED ]; + Metadata metadata = 1; // Write only reporter specific data - ReporterData reporter_data = 245278792 - [ (google.api.field_behavior) = INPUT_ONLY ]; + ReporterData reporter_data = 245278792 [ json_name = "reporter_data", (buf.validate.field).required = true ]; - // The entities that registered this item in the Kessel Asset Inventory. The - // same resource may be registered by multiple reporters. - repeated ReporterData reporters = 353323086 - [ (google.api.field_behavior) = OUTPUT_ONLY ]; - - K8sClusterDetail data = 2122698; + 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 index 785b12f..895c745 100644 --- a/src/main/proto/kessel/inventory/v1beta1/k8s_cluster_detail.proto +++ b/src/main/proto/kessel/inventory/v1beta1/k8s_cluster_detail.proto @@ -1,12 +1,13 @@ syntax = "proto3"; -package kessel.inventory.v1beta1; +package kessel.inventory.v1beta1.resources; -import "kessel/inventory/v1beta1/k8s_cluster_detail_nodes_inner.proto"; +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"; +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"; +option java_package = "org.project_kessel.api.inventory.v1beta1.resources"; option java_outer_classname = "K8sClusterDetailProto"; message K8sClusterDetail { @@ -14,60 +15,64 @@ message K8sClusterDetail { // the aggregate status of the cluster enum ClusterStatus { CLUSTER_STATUS_UNSPECIFIED = 0; - CLUSTER_STATUS_READY = 1; - CLUSTER_STATUS_FAILED = 2; - CLUSTER_STATUS_OFFLINE = 3; + CLUSTER_STATUS_OTHER = 1; + READY = 2; + FAILED = 3; + OFFLINE = 4; } // The kubernetes vendor enum KubeVendor { KUBE_VENDOR_UNSPECIFIED = 0; KUBE_VENDOR_OTHER = 1; - KUBE_VENDOR_AKS = 2; - KUBE_VENDOR_EKS = 3; - KUBE_VENDOR_IKS = 4; - KUBE_VENDOR_OPENSHIFT = 5; - KUBE_VENDOR_GKE = 6; + 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_NONE_UPI = 1; - CLOUD_PLATFORM_BAREMETAL_IPI = 2; - CLOUD_PLATFORM_BAREMETAL_UPI = 3; - CLOUD_PLATFORM_AWS_IPI = 4; - CLOUD_PLATFORM_AWS_UPI = 5; - CLOUD_PLATFORM_AZURE_IPI = 6; - CLOUD_PLATFORM_AZURE_UPI = 7; - CLOUD_PLATFORM_IBMCLOUD_IPI = 8; - CLOUD_PLATFORM_IBMCLOUD_UPI = 9; - CLOUD_PLATFORM_KUBEVIRT_IPI = 10; - CLOUD_PLATFORM_OPENSTACK_IPI = 11; - CLOUD_PLATFORM_OPENSTACK_UPI = 12; - CLOUD_PLATFORM_GCP_IPI = 13; - CLOUD_PLATFORM_GCP_UPI = 14; - CLOUD_PLATFORM_NUTANIX_IPI = 15; - CLOUD_PLATFORM_NUTANIX_UPI = 16; - CLOUD_PLATFORM_VSPHERE_IPI = 17; - CLOUD_PLATFORM_VSPHERE_UPI = 18; - CLOUD_PLATFORM_OVIRT_IPI = 19; + 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; + string external_cluster_id = 219571597 [ json_name = "external_cluster_id", (buf.validate.field).string.min_len = 1 ]; - ClusterStatus cluster_status = 499346904; + ClusterStatus cluster_status = 499346904 [ json_name = "cluster_status", (buf.validate.field).enum = {not_in: [0], defined_only: true} ]; // The version of kubernetes - string kube_version = 395858490; + string kube_version = 395858490 [ json_name = "kube_version" ]; - KubeVendor kube_vendor = 264191642; + 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; + string vendor_version = 23961827 [ json_name = "vendor_version", (buf.validate.field).string.min_len = 1 ]; - CloudPlatform cloud_platform = 476768062; + CloudPlatform cloud_platform = 476768062 [ json_name = "cloud_platform", (buf.validate.field).enum = {not_in: [0], defined_only: true} ]; - repeated K8sClusterDetailNodesInner nodes = 75440785; + repeated K8sClusterDetailNodesInner nodes = 75440785 [ (buf.validate.field).repeated = {min_items: 1, items: { required: true}} ]; } 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 index e5087c9..ac16c92 100644 --- 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 @@ -1,26 +1,29 @@ syntax = "proto3"; -package kessel.inventory.v1beta1; +package kessel.inventory.v1beta1.resources; -import "kessel/inventory/v1beta1/resource_label.proto"; +import "buf/validate/validate.proto"; -option go_package = "github.com/project-kessel/inventory-api/api/kessel/inventory/v1beta1"; +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"; +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; + 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; + string cpu = 98728 [ (buf.validate.field).string.min_len = 1 ]; // Memory Capacity of the node defined as MiB, e.g. \"50Mi\" - string memory = 4014849; + 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 - repeated ResourceLabel labels = 36675587; + // 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 index fb102fc..477b787 100644 --- a/src/main/proto/kessel/inventory/v1beta1/k8s_clusters_service.proto +++ b/src/main/proto/kessel/inventory/v1beta1/k8s_clusters_service.proto @@ -1,39 +1,38 @@ syntax = "proto3"; -package kessel.inventory.v1beta1; +package kessel.inventory.v1beta1.resources; import "google/api/annotations.proto"; +import "buf/validate/validate.proto"; -import "kessel/inventory/v1beta1/k8s_cluster.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"; +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"; +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; + K8sCluster k8s_cluster = 1 [ json_name = "k8s_cluster" ]; } -message CreateK8sClusterResponse { - // The K8s cluster created in Kessel Asset Inventory - K8sCluster k8s_cluster = 1; -} +message CreateK8sClusterResponse {} message UpdateK8sClusterRequest { - // The {resource} format - // \":\". - string resource = 1; - // The k8s clsuter to update - K8sCluster k8s_cluster = 2; + // 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} format - // \":\". - string resource = 1; + // 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 {} @@ -41,21 +40,22 @@ message DeleteK8sClusterResponse {} service KesselK8sClusterService { rpc CreateK8sCluster(CreateK8sClusterRequest) returns (CreateK8sClusterResponse) { option (google.api.http) = { - post : "/api/inventory/v1beta1/k8sClusters" + post : "/api/inventory/v1beta1/resources/k8s-clusters" body : "*" }; }; rpc UpdateK8sCluster(UpdateK8sClusterRequest) returns (UpdateK8sClusterResponse) { option (google.api.http) = { - put : "/api/inventory/v1beta1/k8sClusters/{resource}" + put : "/api/inventory/v1beta1/resources/k8s-clusters" body : "*" }; }; rpc DeleteK8sCluster(DeleteK8sClusterRequest) returns (DeleteK8sClusterResponse) { option (google.api.http) = { - delete : "/api/inventory/v1beta1/k8sClusters/{resource}" + 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..124ee16 --- /dev/null +++ b/src/main/proto/kessel/inventory/v1beta1/k8s_policy.proto @@ -0,0 +1,23 @@ +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"; + +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..0195c99 --- /dev/null +++ b/src/main/proto/kessel/inventory/v1beta1/k8s_policy_detail.proto @@ -0,0 +1,27 @@ +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 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..8403ba7 --- /dev/null +++ b/src/main/proto/kessel/inventory/v1beta1/k8spolicy_ispropagatedto_k8scluster.proto @@ -0,0 +1,23 @@ +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"; + +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..54dc6ec --- /dev/null +++ b/src/main/proto/kessel/inventory/v1beta1/k8spolicy_ispropagatedto_k8scluster_detail.proto @@ -0,0 +1,29 @@ +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"; + +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 index 76203f2..c74df39 100644 --- a/src/main/proto/kessel/inventory/v1beta1/metadata.proto +++ b/src/main/proto/kessel/inventory/v1beta1/metadata.proto @@ -1,15 +1,15 @@ syntax = "proto3"; -package kessel.inventory.v1beta1; +package kessel.inventory.v1beta1.resources; import "google/api/field_behavior.proto"; import "google/protobuf/timestamp.proto"; -import "kessel/inventory/v1beta1/resource_label.proto"; +import "kessel/inventory/v1beta1/resources/resource_label.proto"; -option go_package = "github.com/project-kessel/inventory-api/api/kessel/inventory/v1beta1"; +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"; +option java_package = "org.project_kessel.api.inventory.v1beta1.resources"; message Metadata { // Kessel Asset Inventory generated identifier. @@ -17,23 +17,23 @@ message Metadata { // The type of the Resource string resource_type = 442752204 - [ (google.api.field_behavior) = OUTPUT_ONLY ]; + [ json_name = "resource_type", (google.api.field_behavior) = OUTPUT_ONLY ]; // Date and time when the inventory item was first reported. google.protobuf.Timestamp first_reported = 13874816 - [ (google.api.field_behavior) = OUTPUT_ONLY ]; + [ json_name = "first_reported", (google.api.field_behavior) = OUTPUT_ONLY ]; // Date and time when the inventory item was last updated. google.protobuf.Timestamp last_reported = 436473483 - [ (google.api.field_behavior) = OUTPUT_ONLY ]; + [ json_name = "last_reported", (google.api.field_behavior) = OUTPUT_ONLY ]; // Identifier of the reporter that first reported on this item. string first_reported_by = 46112820 - [ (google.api.field_behavior) = OUTPUT_ONLY ]; + [ json_name = "first_reported_by", (google.api.field_behavior) = OUTPUT_ONLY ]; // Identifier of the reporter that last reported on this item. string last_reported_by = 505008782 - [ (google.api.field_behavior) = OUTPUT_ONLY ]; + [ json_name = "last_reported_by", (google.api.field_behavior) = OUTPUT_ONLY ]; // The workspace in which this resource is a member for access control. A // resource can only be a member of one workspace. diff --git a/src/main/proto/kessel/inventory/v1beta1/notifications_integration.proto b/src/main/proto/kessel/inventory/v1beta1/notifications_integration.proto index daf7b8a..137c40d 100644 --- a/src/main/proto/kessel/inventory/v1beta1/notifications_integration.proto +++ b/src/main/proto/kessel/inventory/v1beta1/notifications_integration.proto @@ -1,27 +1,22 @@ syntax = "proto3"; -package kessel.inventory.v1beta1; +package kessel.inventory.v1beta1.resources; import "google/api/field_behavior.proto"; -import "validate/validate.proto"; +import "buf/validate/validate.proto"; -import "kessel/inventory/v1beta1/metadata.proto"; -import "kessel/inventory/v1beta1/reporter_data.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"; +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"; +option java_package = "org.project_kessel.api.inventory.v1beta1.resources"; message NotificationsIntegration { // Metadata about this resource - Metadata metadata = 1 [ (google.api.field_behavior) = REQUIRED, (validate.rules).any.required = true ]; + Metadata metadata = 1; // Write only reporter specific data ReporterData reporter_data = 245278792 - [ (google.api.field_behavior) = INPUT_ONLY, (validate.rules).any.required = true ]; - - // The entities that registered this item in the Kessel Asset Inventory. The - // same resource may be registered by multiple reporters. - repeated ReporterData reporters = 353323086 - [ (google.api.field_behavior) = OUTPUT_ONLY ]; + [ 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 index 9a6bd28..e0f357e 100644 --- a/src/main/proto/kessel/inventory/v1beta1/notifications_integrations_service.proto +++ b/src/main/proto/kessel/inventory/v1beta1/notifications_integrations_service.proto @@ -1,50 +1,38 @@ syntax = "proto3"; -package kessel.inventory.v1beta1; +package kessel.inventory.v1beta1.resources; import "google/api/annotations.proto"; -import "google/api/field_behavior.proto"; +import "buf/validate/validate.proto"; -import "kessel/inventory/v1beta1/notifications_integration.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"; +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"; +option java_package = "org.project_kessel.api.inventory.v1beta1.resources"; message CreateNotificationsIntegrationRequest { // The NotificationsIntegration to create in Kessel Asset Inventory - NotificationsIntegration integration = 1 [ - (google.api.field_behavior) = REQUIRED - ]; + NotificationsIntegration integration = 1 [ (buf.validate.field).required = true ]; } -message CreateNotificationsIntegrationResponse { - // The NotificationsIntegration created in Kessel Asset Inventory - NotificationsIntegration integration = 1 [ - (google.api.field_behavior) = REQUIRED - ]; -} +message CreateNotificationsIntegrationResponse {} message UpdateNotificationsIntegrationRequest { - // A resource instance using the format: - // \":\" - string resource = 1 [ - (google.api.field_behavior) = REQUIRED - ]; - // The NotificationsIntegration to update - NotificationsIntegration integration = 2 [ - (google.api.field_behavior) = REQUIRED - ]; + // 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 { - // A resource instance using the format: - // \":\" - string resource = 1 [ - (google.api.field_behavior) = REQUIRED - ]; + // 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 {} @@ -52,21 +40,22 @@ message DeleteNotificationsIntegrationResponse {} service KesselNotificationsIntegrationService { rpc CreateNotificationsIntegration(CreateNotificationsIntegrationRequest) returns (CreateNotificationsIntegrationResponse) { option (google.api.http) = { - post : "/api/inventory/v1beta1/notificationsIntegrations" + post : "/api/inventory/v1beta1/resources/notifications-integrations" body : "*" }; }; rpc UpdateNotificationsIntegration(UpdateNotificationsIntegrationRequest) returns (UpdateNotificationsIntegrationResponse) { option (google.api.http) = { - put : "/api/inventory/v1beta1/notificationsIntegrations/{resource}" + put : "/api/inventory/v1beta1/resources/notifications-integrations" body : "*" }; }; rpc DeleteNotificationsIntegration(DeleteNotificationsIntegrationRequest) returns (DeleteNotificationsIntegrationResponse) { option (google.api.http) = { - delete : "/api/inventory/v1beta1/notificationsIntegrations/{resource}" + 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 index 013efb7..567ba66 100644 --- a/src/main/proto/kessel/inventory/v1beta1/reporter_data.proto +++ b/src/main/proto/kessel/inventory/v1beta1/reporter_data.proto @@ -1,51 +1,53 @@ syntax = "proto3"; -package kessel.inventory.v1beta1; +package kessel.inventory.v1beta1.resources; import "google/api/field_behavior.proto"; import "google/protobuf/timestamp.proto"; +import "buf/validate/validate.proto"; -option go_package = "github.com/project-kessel/inventory-api/api/kessel/inventory/v1beta1"; +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"; +option java_package = "org.project_kessel.api.inventory.v1beta1.resources"; message ReporterData { enum ReporterType { REPORTER_TYPE_UNSPECIFIED = 0; - REPORTER_TYPE_ACM = 1; - REPORTER_TYPE_HBI = 2; - REPORTER_TYPE_OCM = 3; - REPORTER_TYPE_OTHER = 4; + REPORTER_TYPE_OTHER = 1; + ACM = 2; + HBI = 3; + OCM = 4; + NOTIFICATIONS = 5; } - ReporterType reporter_type = 245778392; + 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 - [ (google.api.field_behavior) = OUTPUT_ONLY ]; + [ json_name = "reporter_instance_id", (google.api.field_behavior) = OUTPUT_ONLY ]; // Date and time when the inventory item was first reported by this reporter google.protobuf.Timestamp first_reported = 13874816 - [ (google.api.field_behavior) = OUTPUT_ONLY ]; + [ json_name = "first_reported", (google.api.field_behavior) = OUTPUT_ONLY ]; // Date and time when the inventory item was last updated by this reporter google.protobuf.Timestamp last_reported = 436473483 - [ (google.api.field_behavior) = OUTPUT_ONLY ]; + [ json_name = "last_reported", (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; + string console_href = 145854740 [ json_name = "console_href" ]; // Reporter specific API link to the resource. - string api_href = 430210609; + 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; + 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; + 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 index 129169f..6a46595 100644 --- a/src/main/proto/kessel/inventory/v1beta1/resource_label.proto +++ b/src/main/proto/kessel/inventory/v1beta1/resource_label.proto @@ -1,14 +1,16 @@ syntax = "proto3"; -package kessel.inventory.v1beta1; +package kessel.inventory.v1beta1.resources; -option go_package = "github.com/project-kessel/inventory-api/api/kessel/inventory/v1beta1"; +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"; +option java_package = "org.project_kessel.api.inventory.v1beta1.resources"; message ResourceLabel { - string key = 106079; + string key = 106079 [ (buf.validate.field).string.min_len = 1 ]; - string value = 111972721; + 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 index d3c28b1..4333812 100644 --- a/src/main/proto/kessel/inventory/v1beta1/rhel_host.proto +++ b/src/main/proto/kessel/inventory/v1beta1/rhel_host.proto @@ -1,27 +1,22 @@ syntax = "proto3"; -package kessel.inventory.v1beta1; +package kessel.inventory.v1beta1.resources; import "google/api/field_behavior.proto"; -import "validate/validate.proto"; +import "buf/validate/validate.proto"; -import "kessel/inventory/v1beta1/metadata.proto"; -import "kessel/inventory/v1beta1/reporter_data.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"; +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"; +option java_package = "org.project_kessel.api.inventory.v1beta1.resources"; message RhelHost { // Metadata about this resource - Metadata metadata = 1 [ (google.api.field_behavior) = REQUIRED, (validate.rules).any.required = true ]; + Metadata metadata = 1 [ (buf.validate.field) = {required: false, ignore: IGNORE_ALWAYS} ]; // Write only reporter specific data ReporterData reporter_data = 245278792 - [ (google.api.field_behavior) = INPUT_ONLY ]; - - // The entities that registered this item in the Kessel Asset Inventory. The - // same resource may be registered by multiple reporters. - repeated ReporterData reporters = 353323086 - [ (google.api.field_behavior) = OUTPUT_ONLY ]; + [ 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 index 70784fe..bf4b787 100644 --- a/src/main/proto/kessel/inventory/v1beta1/rhel_hosts_service.proto +++ b/src/main/proto/kessel/inventory/v1beta1/rhel_hosts_service.proto @@ -1,50 +1,38 @@ syntax = "proto3"; -package kessel.inventory.v1beta1; +package kessel.inventory.v1beta1.resources; import "google/api/annotations.proto"; -import "google/api/field_behavior.proto"; +import "buf/validate/validate.proto"; -import "kessel/inventory/v1beta1/rhel_host.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"; +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"; +option java_package = "org.project_kessel.api.inventory.v1beta1.resources"; message CreateRhelHostRequest { // The Rhel Host to create in Kessel Asset Inventory - RhelHost host = 1 [ - (google.api.field_behavior) = REQUIRED - ]; + RhelHost rhel_host = 1 [ json_name = "rhel_host", (buf.validate.field).required = true ]; } -message CreateRhelHostResponse { - // The Rhel Host created in Kessel Asset Inventory - RhelHost host = 1 [ - (google.api.field_behavior) = REQUIRED - ]; -} +message CreateRhelHostResponse {} message UpdateRhelHostRequest { - // A resource instance using the format: - // \":\" - string resource = 1 [ - (google.api.field_behavior) = REQUIRED - ]; - // The Rhel host to update - RhelHost host = 2 [ - (google.api.field_behavior) = REQUIRED - ]; + // 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 { - // A resource instance using the format: - // \":\" - string resource = 1 [ - (google.api.field_behavior) = REQUIRED - ]; + // 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 {} @@ -52,21 +40,22 @@ message DeleteRhelHostResponse {} service KesselRhelHostService { rpc CreateRhelHost(CreateRhelHostRequest) returns (CreateRhelHostResponse) { option (google.api.http) = { - post : "/api/inventory/v1beta1/rhelHosts" + post : "/api/inventory/v1beta1/resources/rhel-hosts" body : "*" }; }; rpc UpdateRhelHost(UpdateRhelHostRequest) returns (UpdateRhelHostResponse) { option (google.api.http) = { - put : "/api/inventory/v1beta1/rhelHosts/{resource}" + put : "/api/inventory/v1beta1/resources/rhel-hosts" body : "*" }; }; rpc DeleteRhelHost(DeleteRhelHostRequest) returns (DeleteRhelHostResponse) { option (google.api.http) = { - delete : "/api/inventory/v1beta1/rhelHosts/{resource}" + delete : "/api/inventory/v1beta1/resources/rhel-hosts" + body : "*" }; }; }