Previous topic

Account

Next topic

License

DOCUMENTATION
Last updated 18-May-2016

Subscription

General Subscription

This type represents a subscription with hosting/SaaS services.

The Subscription type schema: download

{
   "apsVersion": "2.0",

   "name": "Subscription",

   "id": "http://aps-standard.org/types/core/subscription/1.0",

   "properties": {
      "trial": {
         "type": "boolean"
      },

      "disabled": {
         "type": "boolean"
      },

      "name": {
        "type": "string",
        "required": false
      },

      "description": {
        "type": "string",
        "required": false
      }
   },

   "structures": {
      "SubscriptionResource": {
         "type": "object",

         "properties": {
            "id":               { "type": "string",
                                  "required": true  },
            "title":            { "type": "string"  },
            "apsId":            { "type": "string"  },
            "apsType":          { "type": "string"  },
            "property":         { "type": "string"  },
            "usage":            { "type": "integer" },
            "limit":            { "type": "integer" },
            "autoprovisioning": { "type": "boolean" },
            "unit":        {
               "type": "string",
               "required": true,
               "pattern": "unit|b|kb|mb|gb|.*"
            }
         }
      }
   },

   "operations": {
      "resources": {
         "verb": "GET",
         "path": "/resources",
         "response": {
            "type": "array",
            "items": {
               "type": "SubscriptionResource"
            }
         }
      }
   }
}

The properties of a subscription have to be filled with the following data:

Property Description
trial Trial flag of the subscription
disabled Disabled flag of the subscription
name Subscription name
description Description of the subscription

The properties of the subscriptionResource structure:

Property Description
id Identifier of subscription resource structure
title Subscription Resource title
apsType APS type related to a resource.
apsId APS resource Id. When a subscription line refers to a particular APS resource - id of the resource.
property If a subscription line refers to some property of an APS resource - the property.
usage Usage of a subscription resource. Absence of the property means that usage can’t be calculated.
limit Limit of a subscription resource. Absence of the property means that the resource has no limit (unlimited).
unit Units to measure limits and usage to resource, such as unit,b,kb,mb,gb and so on

Subscription Service

A resource based on this type is often called ‘context’ or ‘tenant’ service. In a subscription, there is only one resources of this type. The Subscription Service schema: download

{
    "apsVersion": "2.0",
    "name": "subscriptionService",
    "id": "http://aps-standard.org/types/core/subscription/service/1.0",
    "implements": [
      "http://aps-standard.org/types/core/resource/1.0"
    ],
    "relations":
    {
        "account":
        {
            "type": "http://aps-standard.org/types/core/account/1.0",
            "required": true
        },
        "subscription":
        {
            "type": "http://aps-standard.org/types/core/subscription/1.0",
            "required": true
        }
    }
}

Usually, a resource based on this type is auto-provisioned, and then other resources linked with it are provisioned by subscriber’s requests. However, it depends on the application resource model.

A resource based on this type helps to find the respective subscription and account through its required links: subscription and account.

Migratable

Applicability: Odin Service Automation version 6.0.1 and newer

This type allows the provider and resellers to migrate subscriptions between accounts.

The Migratable schema: download

{
	"apsVersion": "2.0",
	"name": "SubscriptionMigratable",
	"id": "http://aps-standard.org/types/core/subscription/migratable/1.0",
	"operations": {
		"migrationPreCheck": {
			"path": "/migrationPreCheck",
			"verb": "POST",
			"response": { "type": "MigrationPreCheckResult" },
			"parameters": { "body": { "kind": "body", "type": "MigrationSet" } }
		}
	},
	"structures": {
		"MigrationSet": {
			"type": "object",
			"properties": {
				"targetAccount": {
					"type": "string",
					"required": true
				}
			}
		},
		"MigrationPreCheckResult": {
			"type": "object",
			"properties": {
				"canMigrate": {
					"type": "boolean",
					"required": true,
					"description": "True if migration is allowed"
				},
				"message": {
					"type": "string",
					"description": "This string will be shown to user in case of migration is not possible"
				}
			}
		}
	}
}

When the provider initiates migration of a subscription from the current subscriber to another, the APS controller calls the migrationPreCheck method at the resource that implements the Migratable type in this subscription. This method returns a structure that allows the system to proceed with the migration or not.

The migrationPreCheck method accepts the MigrationSet structure in the message body that specifies APS ID of the target account resource. It returns the MigrationPreCheckResult structure containing two properties:

  • canMigrate is mandatory. It specifies if the migration is allowed (true) or not (false).
  • If migration is not allowed, the message property is a string that the system will display on the screen.

To enable subscription migration, the resource implementing a management context type (also can be mentioned as tenant) must also implement the migratable type. The management context type was introduced in the relation overview section.