Timespan

A Timespan resource instructs the VMPower automation engine on exactly what automation to perform, at a specified time of day, when associated with a VM Schedule. It is important to note that Timespans are not associated with any specific date. The exact time of execution is determined by the day the timespan is associated within a Weekly Schedule resource.

Attributes

  • action-type - (String) Can either be 'POWER ON', 'POWER OFF', 'RESIZE' or 'BACKUP'
  • backup-retention-days - (Number) The number of days to retain a disk snapshot backup created by this Timespan. (Only used for the BACKUP action-type)
  • last-execution-time - (ISODate) The last time this timespan was executed
  • timespan-type - (String) Either daily for timespan events that occur on this day every week or absolute for a Timespan event that only occurs on this date. If timespan-type is set to absolute you must set date to an ISO 8601 time of the date which this event should occur. The scheduler will then compare the current date (1-31) with the ISO 8601 date field on the timespan. If they match then the timespan will be executed and this Timespan resource will be deleted.
  • date - (ISODate) The date that this timespan should only be executed on. Used when timespan-type is set to absolute.
  • start-milis - (Number) The start time that the event should take place during the day. This is the number of miliseconds from midnight. For example 14400000 cooresponds to 4AM (04:00 hours * 60 minutes/hour * 60 seconds/minute * 1000 miliseconds/second)
  • end-milis - (Number) The end time for the event. This should not overlap with other events and should be 30 minutes long for the best automation reliability.

Relationships

  • resize-actions - (Resize Actions) The resize actions to take on the VMs within this group

Operations

GET /timespans/:id

Retrieves a single Timespan event based on a resource Id (:id)

{
    "links": {
        "self": "http://localhost:3000/timespans/59d31cde52fcc91f1e5a5639"
    },
    "data": {
        "id": "59d31cde52fcc91f1e5a5639",
        "type": "timespans",
        "attributes": {
            "timespan-type": "daily",
            "last-execution-time": null,
            "start-milis": 27000000,
            "end-milis": 28740000,
            "backup-retention-days": 7,
            "action-type": "POWER OFF"
        },
        "links": {
            "self": "https://api.vmpower.io/timespans/59d31cde52fcc91f1e5a5639"
        },
        "relationships": {
            "resize-actions": {
                "data": [],
                "links": {
                    "self": "https://api.vmpower.io//"
                }
            }
        }
    }
}

PATCH /timespans/:id

{
    "links": {
        "self": "http://localhost:3000/timespans/59d31cde52fcc91f1e5a5639"
    },
    "data": {
        "id": "59d31cde52fcc91f1e5a5639",
        "type": "timespans",
        "attributes": {
            "timespan-type": "daily",
            "last-execution-time": null,
            "start-milis": 27000000,
            "end-milis": 28740000,
            "backup-retention-days": 7,
            "action-type": "POWER OFF"
        },
        "links": {
            "self": "https://api.vmpower.io/timespans/59d31cde52fcc91f1e5a5639"
        },
        "relationships": {
            "resize-actions": {
                "data": [],
                "links": {
                    "self": "https://api.vmpower.io//"
                }
            }
        }
    }
}

POST /timespans/:id

Creates a new POWER OFF Timespan event

{
    "data": {
        "type": "timespans",
        "attributes": {
            "timespan-type": "daily",
            "last-execution-time": null,
            "start-milis": 27000000,
            "end-milis": 28740000,
            "backup-retention-days": 7,
            "action-type": "POWER OFF"
        }
    }
}