<commit_before># EnMasse resource definition

This document defines the resources consumed and produced by APIs and can be considered a base for writing the schema for the data formats. The [address model](model.md) defines address spaces and addresses which translates to these resources.

The resources defined herein may be created, deleted and updated through different APIs. Either the
Open Service Broker API, the custom HTTP API, or using AMQP management.

The resources are defined in the JSON format. 

## AddressSpace

GET    /v1/addressspaces         - to retrieve list 
GET    /v1/addressspaces/myspace - to retrieve single address space
POST   /v1/addressspaces         - create and append single or multiple (AddressSpace, or AddressSpaceList) or fail if exists
PUT    /v1/addressspaces         - replace a single or multiple (AddressSpace, or AddressSpaceList) 
PUT    /v1/addressspaces/:name   - create or replace
DELETE /v1/addressspace/:name    - delete


The `AddressSpace` resource defines the type of address space and endpoint for connecting.

```
{
    "apiVersion": "enmasse.io/v1",
    "kind": "AddressSpace",
    "metadata": {
        "name": "myspace", // Required
        "uuid": "4bfe49c2-60b5-11e7-a5d0-507b9def37d9", // Optional
    },
    "spec": {
        "type": "standard", // Required. Default is 'standard', potentially configurable
        "plan": "small", // Optional. This is the aggregate 'size' of the address space (i.e. controls how
                         // many addresses and how many resources each address may consume

        "endpoints": [ // Optional. If not provided, the default generated hostnames will be provided. 
            {
                "name": "endpoint1",             // Required.
                "service": "messaging",          // Required. 
                "host": "messaging.example.com", // Optional. The host name for this endpoint to use for routing by the load balancer
                "cert": {                        // Optional. Self-signed certificates are generated if not specified
                    "provider": "secret",        // Provider of certs may be through secrets or ACME. For 'secret', the secret name must be passed
                    "secretName": "mysecret"
                }
            }
            "mqtt": {
                "host": "mqtt.example.com"
            },
            "console": {
                "host": "console.example.com"
            }
        }
    }
}
```

### AddressSpaceList

```
{
    "apiVersion": "enmasse.io/v1", // Required
    "kind": "AddressSpaceList", // Required
    "items": [
        {
            ...<commit_msg>Update model document with namespace<commit_after># EnMasse resource definition

This document defines the resources consumed and produced by APIs and can be considered a base for writing the schema for the data formats. The [address model](model.md) defines address spaces and addresses which translates to these resources.

The resources defined herein may be created, deleted and updated through different APIs. Either the
Open Service Broker API, the custom HTTP API, or using AMQP management.

The resources are defined in the JSON format. 

## AddressSpace

GET    /v1/addressspaces         - to retrieve list 
GET    /v1/addressspaces/myspace - to retrieve single address space
POST   /v1/addressspaces         - create and append single or multiple (AddressSpace, or AddressSpaceList) or fail if exists
PUT    /v1/addressspaces         - replace a single or multiple (AddressSpace, or AddressSpaceList) 
PUT    /v1/addressspaces/:name   - create or replace
DELETE /v1/addressspace/:name    - delete


The `AddressSpace` resource defines the type of address space and endpoint for connecting.

```
{
    "apiVersion": "enmasse.io/v1",
    "kind": "AddressSpace",
    "metadata": {
        "name": "myspace", // Required
        "namespace": "mynamespace" // Optional
    },
    "spec": {
        "type": "standard", // Required. Default is 'standard', potentially configurable
        "plan": "small", // Optional. This is the aggregate 'size' of the address space (i.e. controls how
                         // many addresses and how many resources each address may consume

        "endpoints": [ // Optional. If not provided, the default generated hostnames will be provided. 
            {
                "name": "endpoint1",             // Required.
                "service": "messaging",          // Required. 
                "host": "messaging.example.com", // Optional. The host name for this endpoint to use for routing by the load balancer
                "cert": {                        // Optional. Self-signed certificates are generated if not specified
                    "provider": "secret",        // Provider of certs may be through secrets or ACME. For 'secret', the secret name must be passed
                    "secretName": "mysecret"
                }
            }
        }
    }
}
```

### AddressSpaceList

```
{
    "apiVersion": "enmasse.io/v1", // Required
    "kind": "AddressSpaceList", // Required
    "items": [
        {
            ...
{'fraction_non_alphanumeric': 0.09432859091794972, 'fraction_numerical': 0.007211069966868057, 'mean_word_length': 2.2014971927635685, 'pattern_counts': {'":': 40, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7053642', 'n_tokens_mistral': 1334, 'n_tokens_neox': 1265, 'n_words': 516}