From 970e46f8409667e034b5c34416921218bfa8cca7 Mon Sep 17 00:00:00 2001 From: Dominik Richter Date: Mon, 25 Sep 2023 13:01:43 -0700 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20rename=20fleet=20=3D>=20inventory?= =?UTF-8?q?=20(#1920)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This better matches the more commonly used definition. We will keep fleet working for the next major version and then slowly deprecate it. Signed-off-by: Dominik Richter --- apps/cnquery/cmd/scan.go | 2 +- providers-sdk/v1/inventory/asset.go | 7 +++-- providers-sdk/v1/inventory/inventory.pb.go | 30 +++++++++++----------- providers-sdk/v1/inventory/inventory.proto | 4 +-- 4 files changed, 23 insertions(+), 20 deletions(-) diff --git a/apps/cnquery/cmd/scan.go b/apps/cnquery/cmd/scan.go index f7f9cb82d8..d5c3ee2d8c 100644 --- a/apps/cnquery/cmd/scan.go +++ b/apps/cnquery/cmd/scan.go @@ -52,7 +52,7 @@ func init() { // v6 should make detect-cicd and category flag public scanCmd.Flags().Bool("detect-cicd", true, "Try to detect CI/CD environments. If detected, set the asset category to 'cicd'.") - scanCmd.Flags().String("category", "fleet", "Set the category for the assets to 'fleet|cicd'.") + scanCmd.Flags().String("category", "inventory", "Set the category for the assets to 'inventory|cicd'.") scanCmd.Flags().MarkHidden("category") } diff --git a/providers-sdk/v1/inventory/asset.go b/providers-sdk/v1/inventory/asset.go index dc75260502..90f7d55a85 100644 --- a/providers-sdk/v1/inventory/asset.go +++ b/providers-sdk/v1/inventory/asset.go @@ -110,8 +110,11 @@ func NewState(state string) State { } var AssetCategory_schemevalue = map[string]AssetCategory{ - "fleet": AssetCategory_CATEGORY_FLEET, - "cicd": AssetCategory_CATEGORY_CICD, + // FIXME: DEPRECATED, remove in v11.0 vv + "fleet": AssetCategory_CATEGORY_INVENTORY, + // ^^ + "inventory": AssetCategory_CATEGORY_INVENTORY, + "cicd": AssetCategory_CATEGORY_CICD, } // UnmarshalJSON parses either an int or a string representation of diff --git a/providers-sdk/v1/inventory/inventory.pb.go b/providers-sdk/v1/inventory/inventory.pb.go index 38e346f9a1..e24023157f 100644 --- a/providers-sdk/v1/inventory/inventory.pb.go +++ b/providers-sdk/v1/inventory/inventory.pb.go @@ -108,19 +108,19 @@ func (State) EnumDescriptor() ([]byte, []int) { type AssetCategory int32 const ( - AssetCategory_CATEGORY_FLEET AssetCategory = 0 - AssetCategory_CATEGORY_CICD AssetCategory = 1 + AssetCategory_CATEGORY_INVENTORY AssetCategory = 0 + AssetCategory_CATEGORY_CICD AssetCategory = 1 ) // Enum value maps for AssetCategory. var ( AssetCategory_name = map[int32]string{ - 0: "CATEGORY_FLEET", + 0: "CATEGORY_INVENTORY", 1: "CATEGORY_CICD", } AssetCategory_value = map[string]int32{ - "CATEGORY_FLEET": 0, - "CATEGORY_CICD": 1, + "CATEGORY_INVENTORY": 0, + "CATEGORY_CICD": 1, } ) @@ -174,7 +174,7 @@ type Asset struct { Options map[string]string `protobuf:"bytes,20,rep,name=options,proto3" json:"options,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` // platform id detection mechanisms IdDetector []string `protobuf:"bytes,31,rep,name=id_detector,json=idDetector,proto3" json:"id_detector,omitempty"` - // indicator is this is a fleet asset or a CI/CD run + // indicator is this is an inventory object or a CI/CD run Category AssetCategory `protobuf:"varint,32,opt,name=category,proto3,enum=cnquery.providers.v1.AssetCategory" json:"category,omitempty"` RelatedAssets []*Asset `protobuf:"bytes,33,rep,name=related_assets,json=relatedAssets,proto3" json:"related_assets,omitempty"` ManagedBy string `protobuf:"bytes,34,opt,name=managed_by,json=managedBy,proto3" json:"managed_by,omitempty"` @@ -296,7 +296,7 @@ func (x *Asset) GetCategory() AssetCategory { if x != nil { return x.Category } - return AssetCategory_CATEGORY_FLEET + return AssetCategory_CATEGORY_INVENTORY } func (x *Asset) GetRelatedAssets() []*Asset { @@ -1494,14 +1494,14 @@ var file_inventory_proto_rawDesc = []byte{ 0x41, 0x54, 0x45, 0x5f, 0x4f, 0x4e, 0x4c, 0x49, 0x4e, 0x45, 0x10, 0x09, 0x12, 0x11, 0x0a, 0x0d, 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x4f, 0x46, 0x46, 0x4c, 0x49, 0x4e, 0x45, 0x10, 0x0a, 0x12, 0x11, 0x0a, 0x0d, 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x44, - 0x10, 0x0b, 0x2a, 0x36, 0x0a, 0x0d, 0x41, 0x73, 0x73, 0x65, 0x74, 0x43, 0x61, 0x74, 0x65, 0x67, - 0x6f, 0x72, 0x79, 0x12, 0x12, 0x0a, 0x0e, 0x43, 0x41, 0x54, 0x45, 0x47, 0x4f, 0x52, 0x59, 0x5f, - 0x46, 0x4c, 0x45, 0x45, 0x54, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x43, 0x41, 0x54, 0x45, 0x47, - 0x4f, 0x52, 0x59, 0x5f, 0x43, 0x49, 0x43, 0x44, 0x10, 0x01, 0x42, 0x32, 0x5a, 0x30, 0x67, 0x6f, - 0x2e, 0x6d, 0x6f, 0x6e, 0x64, 0x6f, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6e, 0x71, 0x75, - 0x65, 0x72, 0x79, 0x2f, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x73, 0x2d, 0x73, 0x64, - 0x6b, 0x2f, 0x76, 0x31, 0x2f, 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x10, 0x0b, 0x2a, 0x3a, 0x0a, 0x0d, 0x41, 0x73, 0x73, 0x65, 0x74, 0x43, 0x61, 0x74, 0x65, 0x67, + 0x6f, 0x72, 0x79, 0x12, 0x16, 0x0a, 0x12, 0x43, 0x41, 0x54, 0x45, 0x47, 0x4f, 0x52, 0x59, 0x5f, + 0x49, 0x4e, 0x56, 0x45, 0x4e, 0x54, 0x4f, 0x52, 0x59, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x43, + 0x41, 0x54, 0x45, 0x47, 0x4f, 0x52, 0x59, 0x5f, 0x43, 0x49, 0x43, 0x44, 0x10, 0x01, 0x42, 0x32, + 0x5a, 0x30, 0x67, 0x6f, 0x2e, 0x6d, 0x6f, 0x6e, 0x64, 0x6f, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, + 0x63, 0x6e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2f, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, + 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x76, 0x31, 0x2f, 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, + 0x72, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/providers-sdk/v1/inventory/inventory.proto b/providers-sdk/v1/inventory/inventory.proto index 3ee81684d9..bbaf17af73 100644 --- a/providers-sdk/v1/inventory/inventory.proto +++ b/providers-sdk/v1/inventory/inventory.proto @@ -31,7 +31,7 @@ enum State { } enum AssetCategory { - CATEGORY_FLEET = 0; + CATEGORY_INVENTORY = 0; CATEGORY_CICD = 1; } @@ -64,7 +64,7 @@ message Asset { // platform id detection mechanisms repeated string id_detector = 31; - // indicator is this is a fleet asset or a CI/CD run + // indicator is this is an inventory object or a CI/CD run AssetCategory category = 32; repeated Asset related_assets = 33;