The Resource type is the base type for any resource operations.
In this document:
Resource schema: download
{
"apsVersion": "2.0",
"id": "http://aps-standard.org/types/core/resource/1.0",
"name": "Resource",
"operations": {
"provision": {
"name": "provision",
"verb": "POST",
"path": "/",
"static": true,
"access": {
"admin": true,
"owner": true,
"referrer": false
}
},
"retrieve": {
"name": "retrieve",
"verb": "GET",
"path": "/",
"access": {
"admin": true,
"owner": true,
"referrer": true
}
},
"configure": {
"name": "configure",
"verb": "PUT",
"path": "/",
"parameters": {
"new": {
"type": "self",
"required": true,
"kind": "body"
}
},
"access": {
"admin": true,
"owner": true,
"referrer": false
}
},
"unprovision": {
"name": "unprovision",
"verb": "DELETE",
"path": "/",
"access": {
"admin": true,
"owner": true,
"referrer": false
}
}
},
"structures": {
"Counter": {
"type": "object",
"properties": {
"usage": { "type": "integer" },
"limit": { "type": "integer" }
}
},
"Limit": {
"type": "object",
"properties": {
"limit": { "type": "integer" }
}
},
"Usage": {
"type": "object",
"properties": {
"usage": { "type": "integer" }
}
},
"NotificationSource":
{
"type": "object",
"properties": {
"type": {
"type": "string",
"format": "uri",
"description": "APS Type of source resources"
},
"id": {
"type": "string",
"description": "Resource which is source of event"
}
}
},
"Notification": {
"type": "object",
"description": "Event notification structure",
"properties": {
"type": {
"type": "string",
"format": "uri",
"required": true,
"description": "Type of event (URI)"
},
"time": {
"type": "string",
"format": "date-time",
"description": "Date-time when event happens"
},
"serial": {
"type": "number",
"description": "Serial number of event (incrementing)"
},
"source": {
"type": "NotificationSource",
"description": "Resource originating the event"
}
}
}
}
}
The base resource does not have any properties.
The resource operations are basic for all APS resources and are described in details in resource operations.
The following structures allow the management platform or other applications to monitor resource usage and set limits on the application resources.
Limit
- a structure used to specify a limit
on a resource usage
... "diskspace": { "limit": 10000000 } ...
Usage
- a structure that allows the management platform or other applications to get the application resource usage
...
"diskspace": {
"usage": 1234567
}
...
Counter
- contains both limit
and usage
properties to make the application set a limit and return resource usage
...
"diskspace": {
"limit": 10000000,
"usage": 1234567
}
...
In an APS Type definition, a disk space counter like in the last example above will look like:
{
"id": "http://webhosting.example.com/types/version/1.0",
"implements": [
"http://aps-standard.org/types/core/resource/1.0"
],
"properties": {
"siteName": {
"type": "string",
"title": "WebSite Name"
},
"diskspace": {
"type": "http://aps-standard.org/types/core/resource/1.0#Counter",
"title": "Website diskspace",
"unit": "kb"
}
}
}
In the platform, the following units are supported in definitions of APS Types that include the above-mentioned structures:
kb
, mb
, gb
, unit
, item
, mb-h
, mhzh
, Kbit/sec-h
, and item-h
.
Note
unit
and item
have the same meaning.
mb-h
, mhzh
, Kbit/sec-h
, and item-h
are used as the units for additive counters.
3. The application is responsible for filling in the usage fields of structures on retrieve requests that the management platform sends periodically.
If a Limit
or Counter
type is used and no limit is provided in the configuration then the value is unlimited.
Follow the Resource Counters demo project to get skills in using additive and non-additive resource counters.