Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a TOC for the inventory-api #13

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 40 additions & 3 deletions src/content/docs/inventory/inventory-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:**
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.

Expand Down