Cost planning

Cost planning

/api/deployment-presets/

A filter backend that uses django-filter. Supported actions and methods:

/api/deployment-presets/

Methods: GET

/api/deployment-presets/<uuid>/

Methods: GET

/api/deployment-plans/

A filter backend that uses django-filter. Supported actions and methods:

/api/deployment-plans/

Methods: GET, POST

Supported fields for creation:

  • namestring
  • customerlink to /api/customers/<uuid>/
  • itemslist of [{preset: {name: string}, quantity: integer}]
  • service – GenericRelatedField

Filter fields:

  • ?customer = UUIDFilter

Order fields: created, name

Example request for creating deployment plan.

POST /api/deployment-plans/
Accept: application/json
Content-Type: application/json
Authorization: Token c84d653b9ec92c6cbac41c706593e66f567a7fa4
Host: example.com

{
    "name": "WebApps",
    "customer": "http://example.com/api/customers/2f8b4e0f101545508d52c7655d6386c8/",
    "service": "http://example.com/api/azure/54121cd1cde24b73a1c194d74a305cd2/",
    "items": [
        {
            "preset": "http://example.com/api/deployment-presets/2debb6d109954afaa03910ba1c6791a6/",
            "quantity": 1
        }
    ]
}

Run PUT request against /api/deployment-plans/<uuid>/ to update deployment plan. Only name and list of items can be updated. List of items should have the same format as POST request. Only customer owner and staff can update deployment plan.

/api/deployment-plans/<uuid>/

Methods: GET, PUT, PATCH, DELETE

Supported fields for update:

  • namestring
  • itemslist of [{preset: {name: string}, quantity: integer}]
  • service – GenericRelatedField

Example rendering of deployment plan and configuration.

GET /api/deployment-plans/c218cbb2f56c4d52a82638ca9fffd85a/
Accept: application/json
Content-Type: application/json
Authorization: Token c84d653b9ec92c6cbac41c706593e66f567a7fa4
Host: example.com

{
    "url": "http://example.com/api/deployment-plans/b12bb98a661749ffb02c8a8439299288/",
    "uuid": "b12bb98a661749ffb02c8a8439299288",
    "name": "Webapp for Monster Inc",
    "customer": "http://example.com/api/customers/790b3c131e894581b3dcf66796d9fa30/",
    "items": [
        {
            "preset": {
                "url": "http://example.com/api/deployment-presets/628cd853ba2a4ce7af5d4fff510b5bd2/",
                "uuid": "628cd853ba2a4ce7af5d4fff510b5bd2",
                "name": "MySQL",
                "category": "Databases",
                "variant": "Large"
            },
            "quantity": 1,
            "total_price": 182.23
        }
    ],
    "service": "http://example.com/api/azure/54121cd1cde24b73a1c194d74a305cd2/",
    "total_price": 182.23
}

Example request for creating deployment plan.

POST /api/deployment-plans/
Accept: application/json
Content-Type: application/json
Authorization: Token c84d653b9ec92c6cbac41c706593e66f567a7fa4
Host: example.com

{
    "name": "WebApps",
    "customer": "http://example.com/api/customers/2f8b4e0f101545508d52c7655d6386c8/",
    "service": "http://example.com/api/azure/54121cd1cde24b73a1c194d74a305cd2/",
    "items": [
        {
            "preset": "http://example.com/api/deployment-presets/2debb6d109954afaa03910ba1c6791a6/",
            "quantity": 1
        }
    ]
}

Run PUT request against /api/deployment-plans/<uuid>/ to update deployment plan. Only name and list of items can be updated. List of items should have the same format as POST request. Only customer owner and staff can update deployment plan.