2.9 KiB
Subscription
double: subscription; brief
Prerequisites
Note
BillingStack does not store merchant customer users. Merchant should manage authorization.
- Merchant and Plan created in BillingStack
- bs-admin Role create in Merchant Identity Manager (e.g keystone)
Process
Note
Try to outline a sample subscription creation process.
- User registers in the merchant portal application using the merchant identity manager (e.g keystone)
POST /v2.0/users
- User login in the merchant portal application using merchant identity manager (e.g keystone)
POST /v2.0/tokens
At this point user has an unscoped token
- User decides to subscribe in one of the merchant plans
3.1 Using the merchan API key & secret portal gathers all the available plans from BillingStack
GET /merchants/<merchant_id>/plans
3.2 User select the desired plan to subscribe in
3.1 Since the current token is unscoped it's necessary to create customer in BillingStack
POST /merchant/<merchant_id>/customers
Using the customer_id obtained from BillingStack a new OpenStack tenant is created this special tenant should be named as : bs-customer-<customer_id>
POST /v2.0/tenants
PUT /v2.0/tenants/<tenant_id>/users/<user_id>/role/<openstack_admin_role_id>
PUT /v2.0/tenants/<tenant_id>/users/<user_id>/role/<billingstack_admin_role_id>
Now it is necessary exchange the unscoped token to a scoped one
POST /v2.0/tokens
3.2 BillingStack subscription is created for the BillingStack customer
3.2.1 Create the BillingStack Subscription
POST /merchants/<merchant_id>/subscriptions
3.2.2 Create a new OpenStack tenant
POST /tenants
This tenant should be named bs-subscription-<subscription_id>
3.2.3 Add OpenStack user to the recently created tenant
PUT /tenants/<tenant_id>/users/<user_id>/roles/<openstack_admin_role_id>
3.2.4 Update subscription resource attribute with the tenant id from OpenStack
PATCH /merchants/<merchant_id>/subscriptions/<subscription_id>
- Now the subscription can start receiving usage data from ceilometer tied by resource attribute