The subscription life cycle covers the creation, updating and deletion of subscriptions and instances. There are six actions:
- Install product
- Update product
- Delete product
- Create instance
- Update instance
- Delete instance
Subscription-level actions are termed product actions to tie in with the general Metrici terminology, and because they can affect instances as well as subscriptions.
The actions are relatively complicated. Product characteristics and existing state need to be checked. Additional information – such as product keys or instance names – may be required. One action may trigger other actions.
Overview of approach
To cope with this complexity, the general approach is:
- Calculate what services need to be performed.
- Ask the user to confirm the services.
- Perform the services.
Calculating the actions
The Product Service Calculator Script provides a single component that can calculate what account services are required to achieve the requested action. This may call other services to perform this calculation, but presents all of this using a simple API. It passes back a list of services and a human-readable description of what will be carried out, as a confirmation.
The Calculate product services process step provides a process wrapper around Product Service Calculator Script.
Confirming the actions
The Product action process step invokes the Calculate product services process step as a sub process. It presents the returned confirmation information to the user. If they agree, the actions are then performed.
The Product action process step is configurable to support the six life cycle actions.
Performing the actions
Once the services are confirmed, the Product action process step invokes the Perform product services process step as a sub process. This runs all the services previously passed back from the calculate step. Instance-level services must run under caller authority, and subscription-level services under the authority of the account authority. The Perform product services step is run under the authority of the caller and manages the switching of credentials required to perform each service.
To prevent Perform product services being used to run arbitrary actions, it is passed a hash of the services previously calculated by Product Service Calculator Script. This hash can only be calculated by the account authority and is used to detect any tampering with the list of services.
Install product
Product install involves the creation of new subscriptions and possibly new instances. It may also involve updating subscription and instances.
New subscriptions may require product keys. To cope with this, the Check product keys process step is invoked prior to the Product action step for install product. If keys are required, this asks the user for them. Once keys are entered and correct, or if keys are not required, the process continues to the install product Product action step to calculate and confirm the services.
The Check product keys step and the Product Service Calculator Script both use the List Required Install Services Service to determine what needs to be done and what keys are required. Check product keys uses the Test Product Key Service to test that the entered product keys are correct.
Update product
Internally, update product is very similar to install product, but is even more complicated.
LIke install product, update product may require product keys, if a new version of a subscription has a dependency on a product that has product keys. (Though this is highly unlikely, it still needs to be checked to prevent users from creating product dependencies as a way of bypassing product key checking.)
If the subscription has instances, they may need to be updated. If the forceInstanceUpdateIndicator product indicator is set, they will be updated automatically. If not, the user needs to be asked. Update product uses the Check update product instances process step after the Check product keys step and before the Product action step for update product, to ask the user whether instances should also be updated.
Uninstall product
The Product action step for uninstall product is preceded by a Check uninstall product step. This determines whether the uninstall is possible. It also asks the user whether instances associated with the subscription should be deleted.
The Check uninstall product step and the Product Service Calculator Script use the Calculate Unsubscribe Impact Service to check whether uninstall is permitted and what instances may be involved.
Create instance
The Product action step for create instance is preceded by a Check create instance step that works out whether the user can create a new instance, and, if they can, asks them for an optional name and node reference for the new instance.
The Check create instance step and the Product Service Calculator Script use the Create Instance Service with the checkIndicator set to true to check whether instance creation is permitted.
Update instance
Update instance requires no additional steps.
Delete instance
Delete instance requires no additional steps.