Jump to: navigation, search

Difference between revisions of "Trove-Instance-Metadata"

(Create)
(Update)
Line 60: Line 60:
 
Response
 
Response
  
Code: '''200'''
+
Codes:
 +
* Positive:  '''200'''
 +
* Negative: ''''404'''
  
 
Empty response body
 
Empty response body

Revision as of 01:34, 31 March 2014

Introduction

This wiki page describes the design for adding user managed metadata to instances.

Blueprint

https://blueprints.launchpad.net/trove/+spec/trove-metadata

Goals

  1. Give trove users the ability to store key/value pairs that have significance to them but is not essential to trove's functionality
  2. Create a user accessible rest API to manage instance metadata
  3. Mimic the design/interface used by Nova for metadata
  4. Implement the model so that it acts like a dictionary to make hooking in metadata into the instance very easy and small

Description

Instance metadata is a feature that has been requested frequently by our users. They need a way to store critical information for their instances and have that be associated with the instance so that it is displayed whenever that instance is listed via the API. This also becomes very usable from a testing perspective when doing integration/ci. We can utilize the metadata to store things like what process created the instance, what the instance is being used for, etc... The design for this feature is modeled heavily on the Nova metadata API with a few tweaks in how it works internally.

With the likelihood of an Openstack official metadata service on the horizon I felt like we needed to keep the entry point of integration very small so that when that service becomes available there will be little code in the instance model to change to make that integration happen. To achieve this I made the model work using the dictionary interface and kept all the heavy lifting and fetching/saving operations are internal to the model and happen automatically when keys are modified.

API

The following section describes the API interface both what needs to be sent to the api and what the responses look like.

Create

POST /instances/{id}/metadata

body:

{
    "metadata": {
        "value": {"one": {"two": [3, 4, 5]}}
    }
}

Response

Codes:

  • Positive: 200
  • Negative: 400
{
    "metadata": {
        "newKey": {"one": {"two": [3, 4, 5]}}
    }
}

Update

Substitute a key and value in the database with a new key and value.

PUT /instances/{id}/metadata/{key}

Body

{
    "metadata": {
        "key": "newKey2",
        "value": {"one": {"two": [3, 4, 5]}}
    }
}

Response

Codes:

  • Positive: 200
  • Negative: '404

Empty response body

Replace

Delete

Show

List

TroveClient

Create

Update

Replace

Delete

Show

List

Integration with Instance

Discussion