diff --git a/src/content/docs/inventory/inventory-api.md b/src/content/docs/inventory/inventory-api.md index 50afc9f..0f37c66 100644 --- a/src/content/docs/inventory/inventory-api.md +++ b/src/content/docs/inventory/inventory-api.md @@ -2,6 +2,26 @@ title: Kessel Asset Inventory APIs --- +- [Reporting a New Resource to Asset Inventory](#reporting-a-new-resource-to-asset-inventory) + - [The Request Body](#the-request-body) + - [Tenancy](#tenancy) + - [Metadata](#metadata) + - [Reporter\_data](#reporter_data) + - [Multiple Reporters](#multiple-reporters) + - [Resource\_data](#resource_data) + - [Resource Deduplication](#resource-deduplication) +- [Resource Lifecycle](#resource-lifecycle) + - [Resource Identification](#resource-identification) +- [Reporting a New Relationship Between 2 Resources](#reporting-a-new-relationship-between-2-resources) + - [The Request Body](#the-request-body-1) + - [Tenancy](#tenancy-1) + - [Metadata](#metadata-1) + - [Reporter\_data](#reporter_data-1) + - [Reporter\_data](#reporter_data-2) + - [Multiple Reporters](#multiple-reporters-1) + - [Relationship\_data](#relationship_data) + - [Relationship Lifecycle](#relationship-lifecycle) + This document does not supersede any information in the API specification. This is meant to help explain why the API works the way that it does. In other words, think of the API specification as the API “syntax” documentation and this as the API “semantics” documentation. **Notes:** @@ -33,12 +53,23 @@ The request body is the resource type. This top level json object is comprised o Required data is marked with an asterisk (*). +#### Tenancy + +All resources registered in Inventory must contain tenancy information. This information is used to determine in which Kessel workspace the resource will be registered. + +Clients of Inventory have two alternatives to provide this tenancy information. If the client sets either _workspace_ or _workspace_id_ in the _metadata_ section, the Inventory will attempt to store the resource in that specific workspace. + +If the client omits this information, Inventory will use extract the organization ID from the token, and derive the default workspace that corresponds to that organization. + +Note that in both cases Inventory will verify that the token has authorization to register the resource in the target workspace. + #### Metadata This object represents the attributes that are common for all resources, no matter the type. The information that a reporter provides for this object is: -* _**org_id***_ -* _**workspace_id**_ +* One of: + * _**workspace**_ - this identifies the workspace by name + * _**workspace_id**_ - this identifies the workspace by ID * _**labels**_ Most of the metadata is generated by the Asset Inventory service, i.e. @@ -143,11 +174,17 @@ The JSON for the resource-relationship is similar to resources, i.e. } ``` +#### Tenancy + +The tenancy considerations for relationships are the same as the ones documented above for reporting new resources. + #### Metadata This object represents the attributes that are common for all resource relationships, no matter the type. The information that a reporter provides for this object is: -* _**org_id***_ +* One of: + * _**workspace**_ - this identifies the workspace by name + * _**workspace_id**_ - this identifies the workspace by ID Most of the metadata is generated by the Asset Inventory service, i.e.